Reputation: 43
I am working on server/multiple client programming. I will cut the chase everything is working well but
foreach(Socket sct in socketArray){
sct.send(data);
}
is not working. It suppose to send data to all connected sockets but only the one who made request getting the response. I was thinking if it is related to tcp packaging? or i dont know why it is not working? If somebody can help i would be really appriciated. Thanks
Upvotes: 1
Views: 228
Reputation: 1062780
assuming data
is byte[]
and that you mean sct.Send
, then: it should work fine, and send the same payload - sequentially - to all the sockets in socketArray
. There isn't anything particularly nuanced here - each socket is independent.
Things to check:
socketArray
actually have the expected number of sockets?NoDelay
enabled?Upvotes: 1