Friday 15 August 2014

Python: .send function of socket programming -


I send a message to the server from 'Hello' to the server using this command on the server

 Send some data to the  # remote server message = 'hello': s.send (message) Print 'Data successfully sent' except the socket Terror: # Failed Print 'Send Failed'   

Now on the server side, I want to see if this message is in the key that is built on the server side.

  msg = c.recvfrom (1024) if msg2 in data2.keys (): print ("Key for this message exists", msg) Other: print ("There is no such key available No, "msg)   

Now, the problem always says that there is no such key, it exits. When I write a message on the server side that I got from the customer. It comes out:

  ('hello', none)   

I do not get it, why does it give it to someone with a greeting .

For this reason I do not find any match in the dictionary. Please tell me where I am wrong.

If you see socket.recvfrom () you will see that it gives a new Google If you want only the data portion, then you are better than calling socket.recv () .

No comments:

Post a Comment