On Tue, 5 Oct 2004 12:00:37 -0000 (UTC), dave@superelite.net
OK, awake again and looking into the beolow problem more... my program pulls a message off of a UDP datagram socket with
int s = socket(AF_INET, SOCK_DGRAM, 0); int iVal; struct sockaddr_in oFromAddr; char msg[1024]; int iMsgLen; socklen_t iFromLen;
oMyAddr.sin_family = AF_INET; oMyAddr.sin_addr.s_addr = htonl(INADDR_ANY); oMyAddr.sin_port = htons(5060); iVal = bind(s, (struct sockaddr *) &oMyAddr, sizeof (oMyAddr));
int iVal = recvfrom(s, (void *)&msg, iMsgLen, 0, (struct sockaddr *) &oFromAddr, &iFromLen);
If this is the actual code, iMsgLen is being used uninitialized.
Also, you're passing the address of msg, which is incorrect. Here's
working code:
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include