Hi,
I am quite new to the MQX and I am having trouble narrowing down which functions to use to simply send and receive a udp packet. I'm pretty sure I have to use socket(), bind(), sendto() and recvfrom() but I don't know what I need to pass to these functions. I am using MQX 3.8 and M52259. Any help would be extremely appreciated.
Thank you
解決済! 解決策の投稿を見る。
First, thanks for the quick reply I do have a couple questions. What libraries would I have to include with this code because I am getting a substantial number of errors when I compile it.
Ex.
UDP_addr.sin_family = AF_INET;
>not a struct/union/class
and
= return_error_if(sock2 == RTCS_SOCKET_ERROR);
>function has no prototype
Also I was wondering if you had missed some closing brackets.
Thank you
There is a nice demo example in the rtcs folder under examples called ipc_udp.
sockaddr_in udp_addr, remote;
defined in rtcs.h
/*
** Socket Address Structure
*/
typedef struct sockaddr_in {
uint_16 sin_family;
uint_16 sin_port;
in_addr sin_addr;
} sockaddr_in;
This is a define.
I don't know where I got it.
I seldom write my own code.
I like to cut and paste.
#define return_error_if(c) { if (c) _mqx_exit(0); }