| PLEX86 | ||
|
select woesI created a very UDP simple server (Linux kernel 2.4.20) that listens on two ports --- 6000 & 7000. I am using select(), but I am seeing some unexpected behavior. The server seems to get "locked" on to the port number on which it receives its first message. For example, if the first message to the server is sent on port 6000, it will receive all subsequent messages on port 6000, but it will simply ignore all messages on port 7000. Similarly, if the first message to the server is sent on port 7000, it will receive all subsequent messages on port 7000, but it will turn deaf to port 6000. I am sure that there is some careless mistake on my part. Any help will be appreciated. Regards, Song ---Sample Source Code--- using namespace std; #define MAXMESG 2048 #define PORT1 6000 #define PORT2 7000 int maxDescriptorg = 0; ----------------------------------------------------------Simply dumps the message contents in hex---------------------------------------------------------void printMessage(void *msg, sizet msgLen) { iosbase::fmtflags oldFmtSettings = cout.setf(ios::showbase); char *msgPtr = (char *)msg; { if(!(i%10)) unsigned char ch = *(msgPtr+i); } cout.setf(oldFmtSettings); Anyone upgrade debian sarge from 2.4 to 2.6 Dances With Crows Yup, except the default kernel shipped with debian Sarge only recognizes 1 gb and I have 2.5 GB... } ----------------------------------------------------------Processes incoming message---------------------------------------------------------void processMsg(int sockd) { int bytesRead, clilen; char mesgMAXMESG; sockaddrin from; sizet addrLen = sizeof(sockaddrin); sizet msgLen; for(;;) { bytesRead = recvfrom(sockd, mesg, MAXMESG, 0,(sockaddr*) &from, (socklent *)&addrLen); { continue; } inetntoa(from.sinaddr) printMessage(mesg, bytesRead); break; } } ----------------------------------------------------------Makes calls to socket(), bind() etc.---------------------------------------------------------int registerNewListener(int& sd, unsigned short portNum, fdset& readSet) { sockaddrin serverDetails; serverDetails.sinfamily = AFINET; serverDetails.sinaddr.saddr = htonl(INADDRANY); serverDetails.sinport = htons(portNum); socklent serverAddrLen = sizeof(sockaddrin); { return -1; } { close(sd); return -2; } Need help installing overexisting linux setup I have an old P-100 system that has no cd drive that I want to install the 2x.com thin client on it. This system has 2 hard drives hda1 and hdb1 the current... int on = 1; { return -3; } FDSET(sd, &readSet); maxDescriptorg = sd; return 0; } ----------------------------------------------------------main---------------------------------------------------------main(int argc, char *argv) { int sockd1, sockd2; fdset readFDSet; FDZERO (&readFDSet); { return -1; } { return -1; } for(;;) { int rc; 1) { return -3; } if(FDISSET(sockd1, &readFDSet)) processMsg(sockd1); if(FDISSET(sockd2, &readFDSet)) processMsg(sockd2); } }
|
||||
Need help installing overexisting linux setup Linux groups from Newsgroups The #1 Usenet Provider on the Internet
|
||||