TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Jim Archer
from: Russell Coker
date: 1995-05-01 19:34:14
subject: Tcp/Ip And Sockets

RC>    In what way?  I admit I haven't gone very far into 
RC> TCP/IP programming in UNIX, but from what I've seen there's 
RC> no major difference that counts.  The UNIX books are great 

 JA> Well, one major and important way is in error handling. You can't just
 JA> check errno like under Unix. To get the errno, you have to call
 JA> sock_errno(). Then, all the macros definde, like EINTR and EAGAIN, are

   You are right.  Writing portable code between OS/2 and UNIX would be
difficult because of this.  However a C++ class library should solve the
problem without too much effort.

 JA> blocking mode of a socket. I have found that its best to call select()
 JA> against a socket to check to see if any data is in the socket before I
 JA> read it. Select() can time out, but recv() can not. If you call recv(),
 JA> and the program accross the wore goes away, your thread is blocked
 JA> indefinately. Since OS/2 has a maximum thread limit, you don't want
 JA> this happening in a server.

   Not a problem.  Just close the socket from another thread and it's not
blocked any more.  That works fine for me.

 JA> Also, I found the docs that come with the toolkit vacume. FOr example,
 JA> look at the explanation of the send() function. No where does it
 JA> explain that send may send some, but not all, of the data it is asked
 JA> to send. In fact, nowhere does it explain that send() actually returned
 JA> the number of bytes sent.

    You're right.  I admit I never looked for obvious things like that in
the docs as I previously knew that it would return the number of bytes
written and that this implies that sometimes it will be unable to write
them all...

 JA> Good luck!

  Thanks.  If I was developing portable OS/2  UNIX TCP/IP code I'd
surely need it!


   cya


--- Maximus/2 2.02
* Origin: Multi - 61-3-739-7145 - multi.apana.org.au (3:633/363)
SEEN-BY: 620/243 632/103 341 348 363 998 633/154 252 260 363 371 373 379
SEEN-BY: 634/384 635/301 502 503 636/100 638/100 640/820 690/660 711/409 410
SEEN-BY: 711/413 430 807 808 809 934 949 955 712/515 713/888 800/1 7877/2809
@PATH: 633/363 260 371 635/503 632/348 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.