MCPcopy Create free account
hub / github.com/DanielOgorchock/ST_Anything / connect

Function connect

Arduino/libraries/Ethernet2/src/utility/socket.cpp:68–84  ·  view source on GitHub ↗

* @brief This function established the connection for the channel in Active (client) mode. * This function waits for the untill the connection is established. * * @return 1 for success else 0. */

Source from the content-addressed store, hash-verified

66 * @return 1 for success else 0.
67 */
68uint8_t connect(SOCKET s, uint8_t * addr, uint16_t port)
69{
70 if
71 (
72 ((addr[0] == 0xFF) && (addr[1] == 0xFF) && (addr[2] == 0xFF) && (addr[3] == 0xFF)) ||
73 ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && (addr[3] == 0x00)) ||
74 (port == 0x00)
75 )
76 return 0;
77
78 // set destination IP
79 w5500.writeSnDIPR(s, addr);
80 w5500.writeSnDPORT(s, port);
81 w5500.execCmdSn(s, Sock_CONNECT);
82
83 return 1;
84}
85
86
87

Callers 1

connectMethod · 0.50

Calls 1

execCmdSnMethod · 0.80

Tested by

no test coverage detected