in reply to Re: chat between client and server
in thread chat between client and server
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: chat between client and server
by roboticus (Chancellor) on Oct 11, 2007 at 13:57 UTC | |
I've loaded up the code, and added a couple of traces and fixed a minor bug. You're having some interaction problems with your console I/O. It works ... sort of. I've run out of time, so I'll give you back the code that I've tried, and show you the symptoms. First, I added some traces, so I could see what was happening--Rather than wait for successful console input, I sent a message on both the client and server side so I could see that they both sent the expected messages. Then I discovered the minor bug: you were using $so instead of $client in the server. Once I did that, the code started almost working. Basically, I could type some text on the server side, and it would appear on the client side. Similarly, I could type text on the client side and it would appear on the server side. But you have to alternate client & server, as successive messages aren't sent until it receives one from the other side. Here's the slightly modified server:
And here's the client:
Unfortunately, I don't know why they're blocking. I don't use threads, so there are several possibilities: Blocking in the IO::Socket::INET module, blocking on your console I/O, console I/O interaction with threads, and others that I can't think of. You might want to dig through perlipc and read perlfunc for more clues. I was expecting to see read and write calls in your code, so when I initially saw it, I was wondering how on earth it was supposed to work. I also didn't see any accept() calls, but apparently the IO::Socket::INET module takes care of that since I clearly see a connection and traffic taking place. If I get an opportunity, I'll check into it some more after work. (Unless, of course, you've already got it solved by then....) ...roboticus | [reply] [d/l] [select] |
|
Re^3: chat between client and server
by roboticus (Chancellor) on Oct 11, 2007 at 13:02 UTC | |
OK ... I'll load it up on my machine and give it a go. I've not used IO::Socket before, and I really should learn it. ...roboticus | [reply] |