Home » U++ Library support » U++ MT-multithreading and servers » How to send msg to specific IP ?
Re: How to send msg to specific IP ? [message #23140 is a reply to message #23119] |
Fri, 18 September 2009 11:35  |
 |
mirek
Messages: 14267 Registered: November 2005
|
Ultimate Member |
|
|
MohamedMonem wrote on Thu, 17 September 2009 13:57 |
luzr wrote on Thu, 17 September 2009 17:27 |
MohamedMonem wrote on Thu, 17 September 2009 04:45 | Hello all,
I made a simple server-client application and the server can accept many clients every time I extract the IP of each client, now how can I Send Msg to specific IP ?!!
Thanks in advance.
|
Do you use 'accept' classics?
|
Could you explain more what is 'accept' classics ?
this is what i do
void App::AcceptClients()
{
while(m_listener.IsOpen())
{
Socket TempSocket;
dword ClientIp;
if(!m_listener.IsError() && m_listener.Accept(TempSocket, &ClientIp))
{
String Ip = FormatIP(ClientIp);
m_clients[Ip] = TempSocket;
}
}
}
m_clients is map<String, Socket, less<String> >
I tried to store socket for each client but this failed I get this error.
Quote: |
rror C2558: class 'Upp::Socket' : no copy constructor available or c
opy constructor is declared 'explicit'
|
I think there are some way to send Msg to specific IP, I can easily store IPs.
thanks in advance.
|
No, that is not how things work. You have to communicate with socket you get in Accept. At that moment, IP is not really interesting to you.
Now what you really need is to provide your 'target' socket in Accept. "One" can be really helpful there.
Now things get really nasty if you would need more than communication opened simultanously. In that case, you will have to choose some context/synchronization system and perhaps Select...
|
|
|
Goto Forum:
Current Time: Mon Aug 25 03:50:43 CEST 2025
Total time taken to generate the page: 0.06793 seconds
|