Lines Matching refs:fds
75 static __maybe_unused void pair_udp_open(int fds[], uint16_t port)
79 fds[0] = socket(PF_INET, SOCK_DGRAM, 0);
80 fds[1] = socket(PF_INET, SOCK_DGRAM, 0);
81 if (fds[0] == -1 || fds[1] == -1) {
97 if (bind(fds[1], (void *) &daddr, sizeof(daddr))) {
101 if (bind(fds[0], (void *) &saddr, sizeof(saddr))) {
105 if (connect(fds[0], (void *) &daddr, sizeof(daddr))) {
111 static __maybe_unused void pair_udp_send_char(int fds[], int num, char payload)
118 if (write(fds[0], buf, sizeof(buf)) != sizeof(buf)) {
122 if (read(fds[1], rbuf, sizeof(rbuf)) != sizeof(rbuf)) {
133 static __maybe_unused void pair_udp_send(int fds[], int num)
135 return pair_udp_send_char(fds, num, DATA_CHAR);
138 static __maybe_unused void pair_udp_close(int fds[])
140 close(fds[0]);
141 close(fds[1]);