Solved

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

Posted on 2001-07-05
4
384 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

734 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