Belle II Software development
b2_socket.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8/* b2_socket.h */
9
10
11#ifndef B2_SOCKET_H
12#define B2_SOCKET_H
13
14/* returns socket descriptor */
15int b2_create_accept_socket(const unsigned short port);
16
17/* returns socket descriptor */
18int b2_create_connect_socket(const char* hostname, const unsigned short port);
19
20/* timeout>0 ... timed I/O (secs), time==0 ... non-blocking I/O, time<0 ... blocking I/O */
21int b2_timed_blocking_io(const int sd, const int timeout /* sec */);
22
23int b2_build_sockaddr_in(const char* hostname, const unsigned short port, struct sockaddr_in* in);
24
25int b2_send(const int sd, const void* buf, const size_t size);
26int b2_recv(const int sd, void* buf, const size_t size);
27
28
29#endif /* B2_SOCKET_H */
30