Tcp server python | Sololearn: Learn to code for FREE!

+1

Tcp server python

so, i bought a book to learn python.then i write the exactly same the code what that book said.here the code. https://code.sololearn.com/cZDdvAxhGCQy/?ref=app the book said,its using python 2.7.but i tried both 2.7 and 3.5.none of them working.whats wrong?

7/28/2017 9:55:38 AM

Kevin AS

5 Answers

New Answer

+2

On line 9, try passing a tuple instead of 2 arguments, like this: server.bind( (bind_ip, bind_port) )

+2

They are string format symbols. When you start your program, instead of %s it prints a string and instead of %d it prints an integer number print("ip address: %s, port number: %d" % ("127.0.0.1", 80)) will print: ip address: 127.0.0.1, port number: 80

+2

Thanks, but I am not. Everyone can learn these things, just need to study a lot

+1

and can u e explain me what is the mean %s :%d ?

+1

bravo.ur genius