#1
  1. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154

    DataArrival Question


    I know that in VB6 when using the Winsock control you need to use Winsock_DataArrival. Does Python need anything like this when using sockets?
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,624
    Rep Power
    4247
    The paradigm is slightly different in python -- mainly the socket code isn't wrapped around such a large wrapper as VB does it. You're much closer to the socket API layer in python and it is not event driven. If you're using blocking sockets, then using socket.recv() will automatically block the program until a certain amount of data is received. If you're using non-blocking sockets, then you can use select.select() to check if there is data available on the socket or not, before attempting to read it.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    Im guessing that I'm using blocking sockets. When I do socket.recv() can I continue on doing more code by using more lines? For example:
    socket.recv(data)
    socket.recv(moredata)
    socket.recv(extradata)
    and so on. Will stuff like that work?
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,624
    Rep Power
    4247
    Yep. BTW there is a new article out today on Devshed:
    http://www.devshed.com/c/a/Python/Sockets-in-Python/
    Check it out.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo