|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
|
Thread Tools | Display Modes |
|
|||
need help with pre-threaded TCP/IP daemon
I'm really sorry but this was just too embarrassing to keep up here(even though unixjingleman is not my name ha ha ha). I won't post any other questions unless i need really need help. At the time i wrote the code it seemed like it was worth asking about it and indeed i got a kind reply.But in retrospect it was just ridiculously trivial and as such doesn't seem worth being up there. Sorry!
thanks Last edited by unixjingleman; 7th May 2013 at 04:50 PM. |
|
|||
Originally i didn't do pthread_join in main() to wait for the threads to terminate. The other obvious errors were fixed too. I don't know why but with two clients the game hangs ONLY after the second move is entered on one of the clients. Thanks for any other comments
Last edited by unixjingleman; 24th March 2013 at 07:37 PM. |
|
|||
It might help to "debug" this by using tcpdump or wireshark, something which shows the tcp traffic going back and forth.
Often what happens in these kind of problems between client/server is that two parties are waiting for input and neither is willing to send. Seeing exactly what each is waiting for will give clues as to where to look in the code. It would also help if you posted the client code here too. |
|
|||
Thank you very much for the reply. I have a new version that i'm almost happy with now. I would post it but i guess it's kinda trivial and maybe not so interesting to seasoned geeks. Will do though if anyone does want to look at it/make comments etc. The main problems were not doing pthread_join in main() and calling daemon in the wrong place. The protocol is only really a sorta joke anyway! Did learn some useful things though. Thanks for the advice comet--berkeley
|
|
|||
Have got two version that work now. It was only trivial after all. I'm pleased that i understand a bit more about the heap and threads/thread-specific-data etc. Thanks for the reply. Did talk to someone who said that thread-specific-data was a bad choice for this application. I'm sure it is overcomplicating things too much for such a trivial program. Sorry to bother this forum with such a trivial program. I guess most of you would have thought it was an april fool!
regards Last edited by unixjingleman; 17th April 2013 at 06:41 PM. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenBSD nsd (name server daemon) imported in CVS | J65nko | News | 2 | 17th January 2010 06:05 PM |
Run daemon as other user than root | phreud | FreeBSD General | 8 | 11th November 2008 04:11 AM |
dbus-daemon | lumiwa | FreeBSD General | 2 | 2nd October 2008 12:05 AM |
MySQL 5.1 install - daemon crashes | zeltus | FreeBSD General | 1 | 25th May 2008 08:39 AM |
How can I start xscreensaver daemon at boot | rex | FreeBSD General | 7 | 15th May 2008 02:34 PM |