* @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. */
| 66 | * @return 1 for success else 0. |
| 67 | */ |
| 68 | uint8_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 |