Sort 25 Discussions, By:
Please Login in order to post a comment
To what port number should be bind the server to ?
I think it is only IP, what is the port number?
def write_string_to_socket(connection, message):
# read message
message = read_string_from_socket(connection)
print "Message received = ", message
if message == "END":
Can you provide some helper functions for Java as for C/C++?
I've solved this problem in Java. Please have a look at
Another thing: don't try to write everything at once to the output. Write to the output stream the same quantity of bytes that is being read from the input stream.
Thanks for your helpful hints. The link you posted seems to be broken, but the project is accessible through https://github.com/kohlschutter/junixsocket.
Python: I had difficulty understanding what it wants me to do.
It simply wants you to define the methods read_string_from_socket, write_string_to_socket to call the appropriate methods on the socket. The socket is created, bound, etc for you and is passed to you as 'connection'.
The same thing (socket.send(), socket.recv(size)) works in Python 2 but not Python 3 - can someone tell me what has changed?