DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 23rd March 2013
unixjingleman unixjingleman is offline
Fdisk Soldier
 
Join Date: Jan 2011
Posts: 70
Thanked 0 Times in 0 Posts
Default 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.
Reply With Quote
  #2   (View Single Post)  
Old 23rd March 2013
unixjingleman unixjingleman is offline
Fdisk Soldier
 
Join Date: Jan 2011
Posts: 70
Thanked 0 Times in 0 Posts
Default

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.
Reply With Quote
  #3   (View Single Post)  
Old 27th March 2013
comet--berkeley comet--berkeley is offline
Old programmer/hacker
 
Join Date: Apr 2009
Posts: 85
Thanked 1 Time in 1 Post
Default

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.
Reply With Quote
  #4   (View Single Post)  
Old 28th March 2013
unixjingleman unixjingleman is offline
Fdisk Soldier
 
Join Date: Jan 2011
Posts: 70
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #5   (View Single Post)  
Old 30th March 2013
unixjingleman unixjingleman is offline
Fdisk Soldier
 
Join Date: Jan 2011
Posts: 70
Thanked 0 Times in 0 Posts
Default

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT. The time now is 06:47 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick