Guest_imported
New member
- Jan 1, 1970
- 0
I have a doubt on winsock control.
I'm developing a simple app that will allow several clients to send messages to a server via winsock. It seems to be working, but I still have a few questions I'd like to clarify.
On the server app I'm using a control array of Winsocks. So each of them will refer to a client. But I think I don't understand very well the principle under Winsock! When I send a message from client to server where will this message be stored? I mean I suppose there is a buffer that will store this messages and then using GetData on the server I'll read from this buffer right?
My problem is: Will this buffer be the same for all the Winsocks on my control array or each Winsock object will have it's own buffer?
I was also thinking on this, if the server gets 2 messages from 1 client and between them I don't call GetData, when I do I will read both messages from the buffer! Is there any way to only allow the client to write to server's buffer if the buffer is empty?
And a last question: What exactly is the .LocalPort property of Winsock should I use different ports to each client-server connection or can they all be the same?
TIA
I really hope you can help to clarify this questions
I'm developing a simple app that will allow several clients to send messages to a server via winsock. It seems to be working, but I still have a few questions I'd like to clarify.
On the server app I'm using a control array of Winsocks. So each of them will refer to a client. But I think I don't understand very well the principle under Winsock! When I send a message from client to server where will this message be stored? I mean I suppose there is a buffer that will store this messages and then using GetData on the server I'll read from this buffer right?
My problem is: Will this buffer be the same for all the Winsocks on my control array or each Winsock object will have it's own buffer?
I was also thinking on this, if the server gets 2 messages from 1 client and between them I don't call GetData, when I do I will read both messages from the buffer! Is there any way to only allow the client to write to server's buffer if the buffer is empty?
And a last question: What exactly is the .LocalPort property of Winsock should I use different ports to each client-server connection or can they all be the same?
TIA
I really hope you can help to clarify this questions