dutchguyjack
Member
Need some help with a linked list in C. I have a client-server program with communication over tcp and udp. When clients connect to the server they are added to a linked list and a communication thread is created for that connection.
Problem is that the thread that adds the client to the list loops endlessly when i try to connect a second client. It doesn't do that when i remove the add_llist() function, so I'm sure there's something wrong with that function. It's probably the most obvious thing ever, but I just cant figure out what causes it.
This is my code: http://pastebin.com/tCxey1DA
Try explicitly initialising the "next" pointer to 0 in your init_node function and see if it makes a difference. I expect it will, but haven't touched C for a while.