MCPcopy Create free account
hub / github.com/brainflow-dev/brainflow / recv

Method recv

src/utils/broadcast_server.cpp:84–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84int BroadCastServer::recv (void *data, int size, char *sender_ip, int max_len)
85{
86 char ip_address_sender[INET_ADDRSTRLEN];
87 memset (ip_address_sender, 0, sizeof (char) * INET_ADDRSTRLEN);
88 struct sockaddr_in socket_addr_recv;
89 memset (&socket_addr_recv, 0, sizeof (socket_addr_recv));
90 int len = sizeof (socket_addr_recv);
91 int res = recvfrom (connect_socket, (char *)data, size, 0, (sockaddr *)&socket_addr_recv, &len);
92 if (res == SOCKET_ERROR)
93 {
94 return -1;
95 }
96 if (inet_ntop (AF_INET, &(socket_addr_recv.sin_addr), ip_address_sender, INET_ADDRSTRLEN) ==
97 NULL)
98 {
99 return -2;
100 }
101 strncpy (sender_ip, ip_address_sender, max_len);
102 return res;
103}
104
105void BroadCastServer::close ()
106{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected