By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,932 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,932 IT Pros & Developers. It's quick & easy.

Scket connection to server

P: n/a
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
Jul 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
The documentation gives an excellent example on how to do this, see
http://docs.python.org/lib/socket-example.html

Jul 19 '05 #2

P: n/a
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):

import socket
s = socket.Socket()
s.connect((10.214.109.50, 29999))
s.send("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.

Steve
Jul 19 '05 #3

P: n/a
Steve Horsley 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):

import socket
s = socket.Socket()
s.connect((10.214.109.50, 29999))
s.send("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.

Steve


Just curious...where do these messages show up @10.214.109.50?

andre

--
Nothing is easier than being busy -
and nothing more difficult than being effective.
Jul 19 '05 #4

P: n/a
On 2005-06-30, André Egners <an**********@rwth-aachen.de> wrote:
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):

import socket
s = socket.Socket()
s.connect((10.214.109.50, 29999))
s.send("Hello, Mum\r\n")


Just curious...where do these messages show up @10.214.109.50?


Um, at port 29999?

--
Grant Edwards grante Yow! does your DRESSING
at ROOM have enough ASPARAGUS?
visi.com
Jul 19 '05 #5

P: n/a
Steve Horsley wrote:
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.


I wouldn't say 'like,' exactly. I've cursed it an awful lot (mostly for
being nonobvious), but it does a damn fine job at networking, especially
if you're comfortable building your own protocols.
Jul 19 '05 #6

P: n/a
Christopher Subich wrote:
Steve Horsley wrote:
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.

I wouldn't say 'like,' exactly. I've cursed it an awful lot (mostly for
being nonobvious), but it does a damn fine job at networking, especially
if you're comfortable building your own protocols.


If you want a communication library that *is* obvious and easy to use,
try Pyro http://pyro.sourceforge.net

--Irmen
Jul 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.