示例#1
0
def pass_socket_and_buffer(step):
    world.server_socket = socket_setup()
    world.server_socket.bind(('127.0.0.1',50000))
    world.server_socket.listen(1)


    world.client_socket = socket_setup()
    world.client_socket.connect(('127.0.0.1',50000))
    world.client_socket.sendall(world.client_message)
    world.client_socket.shutdown(socket.SHUT_WR)

    world.conn, world.addr = world.server_socket.accept()
    world.response = recv(world.conn, 8)
import sys
import socket
from echo_server import socket_setup, recv


if __name__ == "__main__":
	#Client sends string message to server from arg
	client_socket = socket_setup()

	client_socket.connect(('127.0.0.1',50000))
	client_socket.sendall(sys.argv[1])
	client_socket.shutdown(socket.SHUT_WR)

	response = recv(client_socket, 8)
	print response