Code: C++
int main(void)
{
int fd, n,j,i,zin_buf,ObjKods, SignLevel,cnt,nState,nReadCount;
unsigned char buf[255];
unsigned char msg[100];
FILE * pFile;
unsigned char bCRC[2];
unsigned int nCrc;
struct sockaddr_in si_other;
int s, slen=sizeof(si_other);
char buff[512];
char my_array[100];
int nr1;
if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1) diep("socket");
memset((char *) &si_other, 0, sizeof(si_other));
si_other.sin_family = AF_INET;
si_other.sin_port = htons(UDPPORT);
si_other.sin_addr.s_addr=htonl(INADDR_ANY);
if (inet_aton(SRV_IP, &si_other.sin_addr)==0) { fprintf(stderr, "inet_aton() failed\n"); }
if ((s1=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1) diep("socket");
while (1==1) {
/*read info from com port
/*...........
if (sendto(s, my_array[i],512, 0, &si_other, slen)==-1) diep("sendto()");
}
close(s);
return (0);
}
