× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: Sock Programming help
  • From: "Bob Crothers" <bob@xxxxxxxxxxxxxx>
  • Date: Fri, 16 Jun 2000 15:31:42 -0500
  • Importance: Normal

Hendry,

You need to check the return code of EVERY socket call.  Any of them can
return a failed in which case your conversation will be hosed.  And if you
keep trying to use the connection, undesirable results can occur.  Eg: Your
next read can just wait forever.

For your second question, do not do the listen() again until after you have
disconnected the first socket.

Another common thing many do not handle when first getting into the sockets
world is buffer block/un-blocking.  When using TCP, your data will get to
the other end, but it might not be blocked the same way.  Eg: You might send
a single 2048 byte block, but it might arrive as 4 128 byte blocks and then
a 1024 byte block (remaining 512 bytes of first send and 512 bytes of the
NEXT send).  Many times we have heard of folks not taking this into
consideration.  It works fine for a while.  And then something on the
network changes and it all comes crashing down.

For this reason (and others), it is a good idea to encapsulate all of your
sockets stuff into a single service program.  JMHO.

Regards,
Bob Crothers
Cornerstone Communications
Business: www.theunifier.com and www.faxserver401.com
Personal:  www.cstoneindy.com/bob (Don't go here if you aren't a dog
person!)
Email: Bob@CStoneIndy.com
Voice: 317-802-0107 Ext 103
Fax:    317-803-3450

If a messy desk is a sign of a messy mind,
What does an empty desk say?



-----Original Message-----
From: owner-c400-l@midrange.com [mailto:owner-c400-l@midrange.com]On Behalf
Of hendry tionardi
Sent: Friday, June 16, 2000 7:08 AM
To: C400-L@midrange.com
Subject: Sock Programming help

Dear All,

Now I'm coding a socks Programming in AS400 using C.

I had a problem to detect Socket Error when the remote host had already
closed the socket.
Acttually I already put 'Select' Statement for read the socket, but it
didn't  return any error value.

Another thing, I want to make an single connection, So i put :

      Listen(sock,0) but the server still can receive an 2 connection for
the same socket, What should i do if i just want to make 1 connection, and
the rest connection will automaticly rejected.

Thank You


Send FREE Greetings for Father's Day--or any day!
Click here: http://www.whowhere.lycos.com/redirects/fathers_day.rdct
+---
| This is the C/400 Mailing List!
| To submit a new message, send your mail to C400-L@midrange.com.
| To subscribe to this list send email to C400-L-SUB@midrange.com.
| To unsubscribe from this list send email to C400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
bob@cstoneindy.com
+---

+---
| This is the C/400 Mailing List!
| To submit a new message, send your mail to C400-L@midrange.com.
| To subscribe to this list send email to C400-L-SUB@midrange.com.
| To unsubscribe from this list send email to C400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: bob@cstoneindy.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.