i have seen in some examples that when they are explaining the sockets they write a sck.bind(('',PORT)) for server and a sck.connect(('',PORT)) for the client part but when i try to use this code it doesnt work but when i change the client part to sck.connect(('localhost',PORT)) it works fine.
so where is the problem?
and of course i dont really know what bind method does,i know that it binds the host to port but i dont know what this exactly mean ,if you are programming a server-client program when you have a server on the web what should you write in bind method.

Normally you give an IP and a Port. When you tuple them together, that is an ADDRESS for the bind() method and also for the rest of the methods like connect that you gave in your post.

That is valid for C too and I am sure for other programming languages. It is to give a very certain identity for the socket

bind( address)
Bind the socket to address.

Normally the empty string does not define an IP, some languages probably interpret it as localhost, but others may not....that is probably why it doesn't work, but localhost does (IP=127.0.0.1 understood by compiler/interpreter)

....This tutorial is very good:
http://www.devshed.com/c/a/Python/Sockets-in-Python-Into-the-World-of-Python-Network-Programming/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.