|Problems? Is your data what you think it is?|
Using Socketsby Flame (Deacon)
|on Jun 08, 2003 at 04:55 UTC||Need Help??|
Flame has asked for the
wisdom of the Perl Monks concerning the following question:
Fellow monks, I've recently taken an interest in sockets, but during my investigation, I find myself running into one rather simple problem... I don't really know what they are.
Based upon the examples in IO::Socket and IO::Select, I've pieced together enough to say that I have a vague idea how things SHOULD work... but thinking you know how it should work, doesn't mean when you try to use it that way, it will work. So to start with, can anyone point me toward some useful information on sockets?
As an experement, I wrote this, and I am definately not getting the results I expected out of it:
After running this one one system, I run the following on another, those with a clue about this stuff probably can already see some of my problem:
when I run both of them, I get the "Connection Accepted from " message (though nothing follows it, can you retrieve the ip? I've been playing guess and check looking for that...) In the client window, I type something at random such as:
My first problem, is detecting disconnects, as can be seen by the long set of nothing messages (I assume what I actually typed appeared, but was forced off the screen too quickly.) Second is getting the message to actually be sent before closing the client. Third is seeing if I can figure out an IP address. Now, as I mentioned, I'm pretty clueless, so please don't simply give the answer to the question, if you can, please explain why it's the answer.
My code doesn't have bugs, it just develops random features.