Sockets, gui, threading questions

Discussion in 'Perl Misc' started by Dad, Dec 1, 2004.

  1. Dad

    Dad Guest

    I'm really new to Perl so any help or direction on where to look is
    welcomed.

    I used the server example from the Perl Cookbook and modified it to accept
    SNMP trap messages from a Linksys router on UDP port 162, process the
    message as inbound, outbound, or unknown and store in the appropriate
    mysql database table. I want to add a gui to the application and display
    real-time statistics about traffic, etc. I used QTDesigner to build the
    gui seprately and puic to create the final Perl code. The gui now works
    great but only without the "server" code to get/process the traps. I'm
    using IO::Socket for the network interface.

    My problem seems to be the while ($sock->receive($trap,$MAX)) loop is
    blocking and the program hangs until a trap comes in and the buttons on
    the gui are essentially useless. Is there a better way to handle incoming
    udp messages? How can I multi-thread so that the gui continues to
    function and the displays are updated when a message is received? Is
    there a call-back feature I can use?

    Thanks,
    Dad, Dec 1, 2004
    #1
    1. Advertising

  2. On Wed, 01 Dec 2004 21:34:31 +0000, Dad wrote:

    > I'm really new to Perl so any help or direction on where to look is
    > welcomed.
    >
    > I used the server example from the Perl Cookbook and modified it to accept
    > SNMP trap messages from a Linksys router on UDP port 162, process the
    > message as inbound, outbound, or unknown and store in the appropriate
    > mysql database table. I want to add a gui to the application and display
    > real-time statistics about traffic, etc. I used QTDesigner to build the
    > gui seprately and puic to create the final Perl code. The gui now works
    > great but only without the "server" code to get/process the traps. I'm
    > using IO::Socket for the network interface.
    >
    > My problem seems to be the while ($sock->receive($trap,$MAX)) loop is
    > blocking and the program hangs until a trap comes in and the buttons on
    > the gui are essentially useless. Is there a better way to handle incoming
    > udp messages? How can I multi-thread so that the gui continues to
    > function and the displays are updated when a message is received? Is
    > there a call-back feature I can use?
    >
    > Thanks,


    Maybe you can find yourself an answer in BVA's tutorial!
    Billy Ray Padgett, Dec 2, 2004
    #2
    1. Advertising

  3. On 2004-12-02, Billy Ray Padgett scribbled these
    curious markings:
    > Maybe you can find yourself an answer in BVA's tutorial!


    *snarf*

    .... thankfully, I wasn't drinking anything.

    --
    I abhor a system designed for the "user", if that word is a coded
    pejorative meaning "stupid and unsophisticated". -- Ken Thompson
    Linux: "How rebellious ... in a conformist sort of way."
    Unix is user friendly. However, it isn't idiot friendly.
    Christopher Nehren, Dec 2, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dundonald
    Replies:
    2
    Views:
    389
    Steve Horsley
    Mar 15, 2005
  2. Jeremy Bowers

    threading and sockets ?

    Jeremy Bowers, Jan 15, 2005, in forum: Python
    Replies:
    2
    Views:
    278
    Irmen de Jong
    Jan 16, 2005
  3. Philip Zigoris

    Threading problem when many sockets open

    Philip Zigoris, Aug 11, 2007, in forum: Python
    Replies:
    1
    Views:
    293
    Lawrence D'Oliveiro
    Aug 25, 2007
  4. Replies:
    0
    Views:
    288
  5. zayatzz

    Sockets and threading

    zayatzz, Jul 12, 2009, in forum: Python
    Replies:
    3
    Views:
    579
    Dennis Lee Bieber
    Jul 12, 2009
Loading...

Share This Page