Solved

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

Posted on 2001-07-05
4
372 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
Comment Utility
'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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks to all who answered.  Sorry for slow turnaround time.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

771 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now