in reply to Re: perl/tk sockets and fileevent
in thread perl/tk sockets and fileevent

ZenTara, You're quite right. When I was pasting the whole code, I tought the same objection you've justifiedly raised here. But at the moment didnt have time for anything else. I am currently working in writing a super compressed version of both scripts, in addition to other chores my boss gives me every half hour or so. Didnt mean to disrespect you or The Monks valuable time by not posting a proper question. On the contrary, I do know everybody has other duties to take care of and I'm grateful you devote time to my question. Anyway, this code you're posting here I had not seen and will try it. Just a question, though, the socket object in it....is it supposed to be extracted from the acceptor method of the socket? Or is it the socket object itself? Thanks in advance for you attention.

Replies are listed 'Best First'.
Re^3: perl/tk sockets and fileevent
by zentara (Cardinal) on Apr 01, 2006 at 10:58 UTC
    Well the code was from a complete example set which I attached to my email response to your question. I include it below in the readmore, in case you lost the attachments, or some other mailer-incompatibility problems. It is a basic server, and a Tk client. The client sends what is typed in the bottom entry box, and displays the return in the top text box. It is basically what you want to do. You can see that it is basically very simple, when chopped down to just network and Tk code. The fileevent just takes the socket itself, and watches it for when it is readable. When it is, it prints it out. But fileevent will NOT block the rest of the script, like a while loop will. fileevent is basically Tk's version of IO::Select, but adapted to work with the event loop.

    I'm not really a human, but I play one on earth. flash japh
      Ok, Zentara.....it worked!

      You're the man...Send me your address and I'll send a crate of Soles (Mexican beer) your way... ;)

      Besides the fileevent syntax....I needed to write a \n at the end of the string i'm sending to the server. I guess thats why the client was sending the string only after it died.

      Special thanks to g0n and bowie99.....

      heatseekercannibal@hotmail.com