You have not bound the socket. See the
recvfrom function (Windows)[
^]:
Quote:
WSAEINVAL
The socket has not been bound with bind, or an unknown flag was specified, or MSG_OOB was specified for a socket with SO_OOBINLINE enabled, or (for byte stream-style sockets only) len was zero or negative.
See also the above link for example code:
m_socket_address_in.sin_family = AF_INET;
m_socket_address_in.sin_port = htons(ETHERNET_PORT);
m_socket_address_in.sin_addr.s_addr = htonl(IP_ADDRESS);
int bind_status = bind(m_receive_socket, (SOCKADDR *) &m_socket_address_in, sizeof (m_socket_address_in));
sockaddr_in SenderAddr;
receive_status = recvfrom(m_receive_socket,
buff, sizeof(buff),
0,
(struct sockaddr * )&SenderAddr,
sizeof(SenderAddr));