Re: Scket connection to server



On Thu, 30 Jun 2005 18:39:27 +0100, Steve Horsley <steve.horsley@xxxxxxxxx> wrote:
JudgeDread wrote:
hello python gurus

I would like to establish a socket connection to a server running a service
on port 29999. the host address is 10.214.109.50. how do i do this using
python?

many thanks



Off the top of my head (so there could be errors):


There are a few:

import socket
s = socket.Socket()

s = socket.socket()

s.connect((10.214.109.50, 29999))

s.connect(('10.214.109.50', 29999))

s.send("Hello, Mum\r\n")

s.sendall("Hello, Mum\r\n")


That should point you in the right direction, anyway.

There is a higher level socket framework called twisted that
everyone seems to like. It may be worth looking at that too -
haven't got round to it myself yet.

Twisted is definitely worth checking out.

Jp
.



Relevant Pages

  • Scket connection to server
    ... I would like to establish a socket connection to a server running a service ... on port 29999. ... the host address is 10.214.109.50. ...
    (comp.lang.python)
  • Re: Scket connection to server
    ... >>> I would like to establish a socket connection to a server ... >>> running a service on port 29999. ... the host address is ...
    (comp.lang.python)
  • Loop while socket connection exists
    ... I have a script which will create a socket connection to a host. ... The problem is that it still continues to loop even if I take down the interface on the host machine. ... printf "Socket connected\n"; ...
    (perl.beginners)
  • Re: Socket connection between multiple interfaces, through a router
    ... ensure that my socket connection goes through the router, ... creating a local connection? ... Don't send to your host IP addresses. ... through the router and receive them back on the other interface? ...
    (comp.unix.programmer)
  • Measure socket connection time
    ... Just open a socket (host 10.10.10.10 port 15000) ... Measure the time for socket connection, send "quit" and close. ...
    (comp.lang.perl.misc)