> -----Original Message----- > From: Mat Harris [mailto:[EMAIL PROTECTED]] > Sent: Saturday, December 28, 2002 10:27 PM > To: [EMAIL PROTECTED] > Subject: two-way socket troubleshooting > > > i have a client and server which I want to be able to have > communicate in > full-duplex. I need the client to send a string to the > server, the server to > check it and then return a status code (plus some other stuff). > > I have the client and server (see attached .txt files) but > when I run them, > attemping to do a read() and send() from both sides, the client hangs. > > I have tried adding a sleep() but that has no effect. > > please can someone look them over and tell me where I am going wrong. > > thanks guys
Use sysread() and syswrite() instead of read() and send() to avoid blocking on the read. But you need to implement some kind of message protocol. There's no way to guarantee that one sysread() will read the entire message from the client. Also, I *strongly* suggest you use the IO::Socket module, as it encapsulates a lot of gory details for you. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]