UDS Echo Server
UDS Echo Server
rvbugs0 + 0 comments To what port number should be bind the server to ?
evanlarsen + 0 comments aww.. where is the .NET love? c# or f#? or even javascript would be nice
kumaranSR4 + 0 comments Answer:
Python
def write_string_to_socket(connection, message): connection.send(message)
def read_string_from_socket(connection): return connection.recv(1024)
def process_client_connection(connection):
while True: # read message message = read_string_from_socket(connection) print "Message received = ", message sys.stdout.flush() if message == "END": break write_string_to_socket(connection, message)
xenomacx + 0 comments Can you provide some helper functions for Java as for C/C++?
jklebes + 0 comments 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?
Sort 26 Discussions, By:
Please Login in order to post a comment