Op 08-04-13 09:06, Mousumi Basu schreef:
I want to perform binding between two computers having ip addresses 172.18.2.11 and 172.18.2.95.So <http://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()
You are hiding the error message here. Just print msg and see why it fails.

Timo



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)







_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to