Ejemplo n.º 1
0
def generic_consend_test(server, port):
    s = socket()
    data = Buffer("hello world")
    s.connect((server, port))
    data.make_buffer_sendable()
    s.send(data.get_buf())
    s.close()
Ejemplo n.º 2
0
def generic_interact_test(server, port):
    s = socket()
    data = Buffer("hello there\n")
    data.make_buffer_sendable()
    print hex(len(data.get_buf())), hex(data.read_int()),data.get_buf()
    s.connect((server, port))
    s.send(data.get_buf())
    data.reset()
    data.append("Do you have and Grey Poupon?\n")
    data.make_buffer_sendable()
    print hex(len(data.get_buf())), hex(data.read_int()),data.get_buf()
    s.send(data.get_buf())
    buf = s.recv(65535)
    print buf
    bufs = input("Enter a response")
    s.send(bufs)
    s.close()