http://www.perlmonks.org?node_id=21005

rbhat007 has asked for the wisdom of the Perl Monks concerning the following question:

I have written a simple TCP chat server using IO:Socket but once I get the server to listen, it will not go on to execute the rest of the program (because it waits for a connection). Is there any way to start the one subroutine of the server listening in the background?

Originally posted as a Categorized Question.

  • Comment on How can I listen on a socket 'in the background?'

Replies are listed 'Best First'.
Re: How can I listen on a socket 'in the background?'
by Russ (Deacon) on Jul 17, 2000 at 02:14 UTC
Re: How can I listen on a socket 'in the background?'
by Anonymous Monk on Apr 24, 2001 at 21:47 UTC
Re: How can I listen on a socket 'in the background?'
by mslattery (Initiate) on Apr 19, 2002 at 18:35 UTC
    Hello,

    I'm currently writing a program that does what you are asking about. But I would need more information to help you.

    What type of connections are you looking for on this socket?

    Single Client / Multiple Client
    Nonblocking / Blocking IO

    It sounds like you need a nonblocking IO program that supports multiple clients?

    Let me know so I can help.

    thanks,
    mslattery

    Originally posted as a Categorized Answer.

Re: How can I listen on a socket 'in the background?'
by Juerd (Abbot) on Apr 19, 2002 at 18:50 UTC
Re: How can I listen on a socket 'in the background?'
by Ressor (Initiate) on Mar 26, 2008 at 00:37 UTC
    I'm having the same issue and although I read the posts that were recomended here, I'm still lost. I uderstand that you can read from multiple sockets with the code suggested, but I only want to continuosly watch for data on one socket with one client sending data and execute the rest of my Perl/tk app while this is hapening. Any ideas...