PLEX86  x86- Virtual Machine (VM) Program
 Plex86  |  CVS  |  Mailing List  |  Download  |  Linux  |  Newsgroups

TCP connection refused 4259


Your Ad Here

Your Ad Here

Ah..great! it was this, thanks Scott. I'm not sure why it wasn't working before, but I changed the listening address to htonl(IADDRANY) and it worked fine...this doesn't help me do the same to my C# service but never mind.

Another problem perhaps you can advise me on... now I've got it working, data is being sent back and forward reliably and the number of bytes sent is always right. However I've got a problem that's a bit more of a logic issue - I'll describe what happens: the client connects to the server, and sends data first. The server recv()s this data successfully. However I would like it so that the server can receive all the data in multiple chunks (i.e. in a loop with a call to recv on each iteration)... but the problem is knowing how to stop this loop. The bit I can't get my head round is... the call to recv never returns 0 - it returns positive integer while there is still data (which fills the buffer correctly) - but then blocks indefinitely when all the data has been received... *unless* - it sends some data back on each iteration, as in an echo server. But what if I want to receive all the data before formulating the response? I could think of one solution which is to designate a zero-terminator for the data. But this is slightly messy as it requires extra code, possibly with a loop, to detect this terminator byte. I don't want to send dummy data over the network as this is causing unnecessary traffic. The code I've got for the server is:

Intel to cut Linux out of the content market 4262
Stan Goodman Because Microsoft isn't going to roll over and play dead. I think these are the major blind spots of the Linux community: everything is fine, the GPL...

std::string datatoconsider(); char bufRECVBUFLEN + 1; do { int bytesrecvd = recv(Socket, buf, RECVBUFLEN, 0); Sleep(0); if(bytesrecvd == SOCKETERROR) throw(5); { bufmin(bytesrecvd, RECVBUFLEN) = '-0'; printf("%s", buf);-in the non-demo application this would be probably appended to a std::string or something instead... printf("Sent %d bytes back-n", send(Socket, buf, bytesrecvd, 0)); -don't want to do this every time! -instead I want to do this.. -datatoconsider += buf; } else break;-this break never occurs } while(TRUE); -here is where I want to send some data back, once and only, e.g. send(Socket, ProcessAllData(datatoconsider), datatoconsider.length, 0); printf("-n");

tprintf(T("-nClient has disconnected-n"));

does that make sense what I'm trying to get at?

TCP connection refused 4260
Well, I'm beginning to think it might be easier to go down that route...however Scott's suggestion...

Thanks!



Your Ad Here

List | Previous | Next

TCP connection refused 4260

Linux groups from Newsgroups

The #1 Usenet Provider on the Internet

Stay Out of MY Mailbox! Was "Famous Hacker Uses ChallengeResponses