blob: a0c1fe2d1910a2d86010b9d794773274cd3e0214 [file] [log] [blame]
brians343bc112013-02-10 01:53:46 +00001#ifndef AOS_NETWORK_SEND_SOCKET_H_
2#define AOS_NETWORK_SEND_SOCKET_H_
3
4#include "Socket.h"
5
6namespace aos {
7
8class SendSocket : public Socket {
9 public:
Brian Silverman3204dd82013-03-12 18:42:01 -070010 //inline int Send(const void *buf, int length) { return Socket::Send(buf, length); }
brians343bc112013-02-10 01:53:46 +000011 // Connect must be called before use.
12 SendSocket() {}
13 // Calls Connect automatically.
Brian Silvermana9cbe302013-03-12 18:41:44 -070014 SendSocket(NetworkPort port, const char *robot_ip) {
brians343bc112013-02-10 01:53:46 +000015 Connect(port, robot_ip);
16 }
Brian Silvermana9cbe302013-03-12 18:41:44 -070017 int Connect(NetworkPort port, const char *robot_ip, int type = SOCK_DGRAM);
brians343bc112013-02-10 01:53:46 +000018
19 static const size_t MAX_MSG = 4096;
Brian Silvermana9cbe302013-03-12 18:41:44 -070020 char hold_msg_[MAX_MSG];
21 size_t hold_msg_len_;
22 int SendHoldMsg();
brians343bc112013-02-10 01:53:46 +000023};
24
25} // namespace aos
26
27#endif
28