[Tutor] Socket Programming
Mousumi Basu
mousumi251 at gmail.com
Mon Apr 8 09:06:19 CEST 2013
I want to perform binding between two computers having ip addresses
172.18.2.11 and 172.18.2.95.So i wrote the following code(on the computer
having IP address 172.18.2.95):-
import socket
import sys
s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
try:
s=s.bind(('172.18.2.11',2213))
print 'socket bind is complete'
except socket.error,msg:
print 'bind failed'
sys.exit()
The output is :-
bind failed
but when i am writting;-
s=s.bind(('localhost',2213))
the output is;-
socket bind is complete
Can you please tell me where i am making the error?
(The computers are connected as the ping operation is executing properly in
command prompt)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130408/6a39b3fd/attachment.html>
More information about the Tutor
mailing list