1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
5 Demonstration of sending bytes over a TCP connection using sendmsg.
8 from socket import socketpair
10 from twisted.python.sendmsg import send1msg, recv1msg
13 foo, bar = socketpair()
14 sent = send1msg(foo.fileno(), "Hello, world")
15 print "Sent", sent, "bytes"
16 (received, flags, ancillary) = recv1msg(bar.fileno(), 1024)
17 print "Received", repr(received)
18 print "Extra stuff, boring in this case", flags, ancillary
20 if __name__ == '__main__':