Belle II Software  release-05-02-19
b2_socket.h
1 /* b2_socket.h */
2 
3 
4 #ifndef B2_SOCKET_H
5 #define B2_SOCKET_H
6 
7 /* returns socket descriptor */
8 int b2_create_accept_socket(const unsigned short port);
9 
10 /* returns socket descriptor */
11 int b2_create_connect_socket(const char* hostname, const unsigned short port);
12 
13 /* timeout>0 ... timed I/O (secs), time==0 ... non-blocking I/O, time<0 ... blocking I/O */
14 int b2_timed_blocking_io(const int sd, const int timeout /* sec */);
15 
16 int b2_build_sockaddr_in(const char* hostname, const unsigned short port, struct sockaddr_in* in);
17 
18 int b2_send(const int sd, const void* buf, const size_t size);
19 int b2_recv(const int sd, void* buf, const size_t size);
20 
21 
22 #endif /* B2_SOCKET_H */
23