Solved

Are the functions defined in winsock2.h poratble to the PowerPC?

Posted on 2001-07-05
4
378 Views
Last Modified: 2012-08-14
I'm trying to find out if the select function implented in winsock2.h is portable to other systems.  It dosen't what the WSA prefix, so I think it should be portable, but am not sure.  If not, how else can you avoid causing a socket to block from a recv call when the buffer has no data?
0
Comment
Question by:bleek
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
ID: 6257212
'select()' is portable - see e.g. http://man-pages.net/linux/man2/select.2.html 

It is part of the BSD socket spec, so you can expect it to be implemented the same way on virtually all platforms. The MSDN pages don't even mention differences to the BSD 'select()'
0
 
LVL 3

Expert Comment

by:stimpyjcat
ID: 6258152
The select function as implemented in win32 does not have exactly the same capabilities as on most unix systems, in that its functionality is more limited.  win32 select can only monitor file descriptors which are sockets, while on unix systems they can monitor other types of file descriptors as well.  If you're starting on win32, though, this difference shouldn't matter.

Another way of preventing blocking on a socket call is to invoke fioctl on the socket with an argument of FIONBLOCK (aka FNDELAY).  I'm not sure if this is available on win32, though.  MS has probably implemented an alternative interface that does the same thing.

See the FAQ section on win32 vs cygwin socket API at cygwin.com.  Cygwin was written to make unix code portable to win32.
0
 
LVL 5

Expert Comment

by:proskig
ID: 6259102
The answer is basically as following: generally Winsock 2 functions do not have analogues in UNIX (so called BSD sockets), but mainly alsmost all Winsock 1 functions do have analogues in BSD sockets. And some Winsock 2 functions do have analogues in Winsock 1, e.g. WSARecv - recv.

I think the following article answers your question

http://www.cyberport.com/~tangent/programming/winsock/articles/bsd-compatibility.html
0
 

Author Comment

by:bleek
ID: 6259344
Thanks to all who answered.  Sorry for slow turnaround time.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
multi threaded debug dll option in visual studio 2 108
Focus not getting shifted out of  editbox 2 63
How to split this in C++ 4 102
sorting efficency of sorting algorithm 30 113
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question