Tekkotsu Networking CPSC 599 17601 17 Basics Provides
Tekkotsu Networking CPSC 599. 17/601. 17
Basics Provides UDP and TCP Server and Client connections Low level commands Have to build packet Serialise your data (with some help) Bad Documentation PLEASE post on the wiki if you find some Use Tekkotsu monitor aibo-side code /usr/local/Tekkotsu/Behaviors/Mon/*
Interface Uses callbacks for incoming data Non-blocking sending calls Connections used through the ‘Socket’ class one socket per connection Sockets managed by ‘Wireless’ class Mainly important for TCP stderr output is blocking for debugging purposes Accessed through global ‘wireless’ variable System cout/cerr (Telnet ports) serr->printf, sout->printf
API and commands Create a new socket Get system Socket number Socket wireless->socket(Socket. NS: : Transport. Type_t); (SOCK_DGRAM, SOCK_STREAM) Int Socket->sock; Setup server wireless->set. Daemon(Socket, bool); wireless->set. Receiver(Socket_ID, callback); Callbacks: int callback_fn(char *buf, int bytes); wireless->listen(Socket_ID, port) (UDP server does not automatically connect)
API (Continued…) Disable Server wireless->set. Daemon(Socket, false); wireless->close(Socket); Status (NOTE: Works even when no one connectd. Not so for client) bool Wireless->is. Connected(Socket); bool Socket->get. Daemon(); string Socket->get. Peer. Address. As. String() int Socket->get. Peer. Port(); Connect wireless->connect(Socket, char *host, int port);
Api – Packets Packet Write buffer Socket->get. Write. Buffer(int bytes); Socket->write(char *buf, int bytes); Careful when using together Write does buffer copy Load. Save class Serialisation functions Can derrive and make your own MANY encode/decode combinations
Endianness The AIBO is little Endian Tekkotsu does NOT automatically convert (your pc is most likely BIG Endian) Network protocols are big endian Byte order is reversed for primitives AIBO is slow, your PC is faster Means you have to do your own conversion! Alternatives are Serializer class, but slow!
- Slides: 7