Connecting Tech Pros Worldwide Forums | Help | Site Map

client server query

Newbie
 
Join Date: Aug 2008
Posts: 10
#1: Sep 27 '08
Hello everybody..
i m thinking to develop an application in c# which enables transfer of file from server which ll be installed on remote computer to client(my computer)... now my query is how ll the server know that it has to send files to me(client) over internet.. can any1 explain me how this can be done with an code snippet .. hope i ll get a respone.. thanking you


//its a windows based application ..
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#2: Sep 27 '08

re: client server query


Well, we can't give you a code snippet, because the question is a tad vague.

Is this a situation where a client will request a file from the server, or will the client be a listener, and the server will make the initial connection?

I believe that the Sockets is what you'll need to implement this either way. Look into TcpListener and TcpClient. The MSDN entries should be the top hit on google.

If it is the former, your server will need to implement the listener. If it is the latter, the client will need to be a listener, but it will first need to register itself with the server somehow, so the server can know it's IP. That's a difficult situation, because if the client is on a computer with DHCP, that IP will change, and the program will need to register itself on a regular interval.
Newbie
 
Join Date: Aug 2008
Posts: 10
#3: Sep 27 '08

re: client server query


ya the client will make a request to the server for a file.. my ip address is dynamic so i cant hard code the IP in the server .. so wondering how to go about this..
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#4: Sep 27 '08

re: client server query


Quote:

Originally Posted by Drupan c

ya the client will make a request to the server for a file.. my ip address is dynamic so i cant hard code the IP in the server .. so wondering how to go about this..

Well, that will be a real problem. A dynamic IP address makes serving anything difficult. But there is one option, the one I use: DynDNS. That could help you.
Newbie
 
Join Date: Aug 2008
Posts: 10
#5: Sep 29 '08

re: client server query


Quote:

Originally Posted by insertAlias

Well, that will be a real problem. A dynamic IP address makes serving anything difficult. But there is one option, the one I use: DynDNS. That could help you.


hey insertAlias thanks your idea bout dynDNS is too good... u solved half of my problem .. now i m trying to work on the firewall issues.. i think firewall will block the files to be sent from the server(remote system) to mysystem(client) .. now i have to register the program as a trusted windows program.. am i right???
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#6: Sep 29 '08

re: client server query


Depending on what your firewall is, you should be able to add exclusions or exceptions to it.

I'm not sure that you can do this programatically, because that would be a serious security violation.
Newbie
 
Join Date: Aug 2008
Posts: 10
#7: Sep 29 '08

re: client server query


Quote:

Originally Posted by insertAlias

Depending on what your firewall is, you should be able to add exclusions or exceptions to it.

I'm not sure that you can do this programatically, because that would be a serious security violation.


tats rit... wel the application i m trying to develop is to send the files to me.. well here the user will be aware of the files being sent to me.. infact the user will be prompted to select the file which ll be sent.. here nothing malicious is happening.. so the only issue is the firewall .. going through articles to get this part done..
Reply