Hi!
Do someone use sockets in multithreading? I am trying to implement bidirectional socket connection with simultaneous reading/writing operation. There are two threads - one for reading and one for writing. The code is very simple (just schematic):
On the server side I see only the first connection (1st click of button)... then no connections. Writing to socket is executing without error... so it seems the data is written but where I don't know. Any ideas?
Do someone use sockets in multithreading? I am trying to implement bidirectional socket connection with simultaneous reading/writing operation. There are two threads - one for reading and one for writing. The code is very simple (just schematic):
BUTTON Clicked Process
// Place data when buttons is clicked
PlaceSomeDataInSendingQueue()
...
// Sending procedure
PROCEDURE Sending
SocketConnect("SOCK",Port,"IP")
...
LOOP
Data is string = TakeSomeDataFromSendingQueue()
CriticalSectionStart()
SocketWrite("SOCK","data")
CriticalSectionEnd()
END
// Reading procedure
PROCEDURE Reading
...
LOOP
CriticalSectionStart()
Data is string = SocketRead("SOCK",False)
CriticalSectionEnd()
IF Data = "" THEN CONTINUE
END
On the server side I see only the first connection (1st click of button)... then no connections. Writing to socket is executing without error... so it seems the data is written but where I don't know. Any ideas?