Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2001-07-05
4
Medium Priority
?
390 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 400 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

876 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