2013/04/27

04/20-04/26 Assignment Log

So I wrote out about half of this log four hours ago, only for my internet to go down and blank this page, and then stay down for the next two hours.

One trivial mistake I kept making was after passing from the listening socket to the worker socket, I would still call the listening socket. This was the last bug I had before my TCP server started working. I kept trying to delete the buffer like so:

delete [] & buffer

Honestly, no idea why I ever tried that. Eventually I had to common sense to comment it out. And it also got working again. I tried to copy directly from &rNodeList.size() to a buffer with memcpy, couldn't get that working either.

The UDP server was surprisingly harder than the TCP server. I was receiving Winsock Error 10014 because I was using sizeof() wrong. Then I got Error 10013, which is a permissions issue so I had to manually add the debug executables to Windows Firewall. Turns out the Firewall had nothing to do with it. Fixed a couple things and it looped me back to Error 10049, which I had received before.

Alright, my internet's back after losing my internet over 9000 times tonight. Here are the mistakes I made converting from TCP to UDP:

Server
1. local.sin_addr.s_addr set to inet_addr(HOST) instead of INET_ANY.
2. Forgot to remove the listen() method.
3. Kept worker socket and waited with the accept method.

Client
1. Used 0 instead of  IPPROTO_UDP
2. Tried using *((unsigned long*) host->h_addr) from the tutorial for the hostname instead of remote.sin_addr.S_un.S_addr, which worked.
3. Forgot to remove the connect block and that's where all those errors came from (I should have printed the block I was receiving the errors in).

No comments:

Post a Comment