On 08/04/13 08:06, Mousumi Basu wrote:

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()

Your first error is that when developing you don't want to hide the error messages so add a raise statement to the except block so you get the full traceback with all of its helpful details.


but when i am writting;-

s=s.bind(('localhost',2213))

the output is;-
socket bind is complete

Which suggests that the 172... IP address you are using above is not recognised... or maybe has a firewall around it, or some other restrictions on access.

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)

It is most likely a network configuration issue but only you can fix that since we can't see how the network is set up. Rather than using ping try using telnet to reach the IP address and port and see what response you get.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

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

Reply via email to