Solved

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

Posted on 2001-07-05
4
385 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

  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 …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

632 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