Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i created a chating window application in a lan network and its working fine

but my question is "whenever server want connect to client pc, it should show a pop up window in client system for accepting connection from server and then only connection should established,
please guide me how to achieve this.

I am using system.Net.socket namespace in c#.
Posted
Comments
Richard MacCutchan 29-Nov-13 6:53am    
Add some code in your client to listen for connect requests from the server, and pop up a dialog when that happens.
Ashwani Gusain 29-Nov-13 7:30am    
Hi mac

how can get initial response from client pc?

I am using this code for connecting client pc.

remote = new IPEndPoint(IPAddress.Parse(textremotip.Text), Convert.ToInt32(textremoteport.Text));
sckt.Connect(remote);
Richard MacCutchan 29-Nov-13 7:35am    
As I said you need to add code to your client to pop the dialog when it gets a connect request from the server.
Ashwani Gusain 29-Nov-13 7:44am    
mac that code i dont know thats why i asked
sckt.connect(remote); using this line its get connecting automatically.

i am not getting any automatic pop up window for client.

please help
Richard MacCutchan 29-Nov-13 7:48am    
You need to write the code, and add it to your client where it listens for a connection.

1 solution

Hi Ashwani,
In actual scenario client gets connected with server. I hope in your case it is opposite.
follow this link
http://msdn.microsoft.com/en-us/library/kb5kfec7%28v=vs.110%29.aspx[^]

Here at server side
sender.Connect(remoteEP);

after this line you can have a alert message that (even u get the IP address of requester in EndPoint remoteEP) for user a Dialog box can be displayed.

If the Dialog result is yes then you can continue
else you can close the connection

sender.Close();


Hope this is useful.

Regards,
Arun
 
Share this answer
 
Comments
Ashwani Gusain 29-Nov-13 7:20am    
Hi arun this is my code for connecting remote pc.
but this not giving any messagebox for client pc its automatically connected.

but i want pop up window in client pc where we want connect.

remote = new IPEndPoint(IPAddress.Parse(textremotip.Text),Convert.ToInt32(textremoteport.Text));
sckt.Connect(remote);
arunrv 29-Nov-13 7:37am    
Ya I accept it that it wont show the alert message . Need to write the code for that
see this link
http://www.dotnetperls.com/messagebox-show
Ashwani Gusain 29-Nov-13 23:28pm    
arun iam unble to find answer please help with some code lines

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900