Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to transfer file from a server to a client

Status
Not open for further replies.

myzone

Programmer
Jul 11, 2000
1
US
Hi everyone Please help me if you can, I am writing this program to create a client and a server to communicate between each other over a network. I have the following part working, it is where the client send a file to the server, and the server receives it and saves it under a different file name.<br><br>Now, I need to send that same file to the client, and I have no clue on how to do. I have try alot of different ways and none of the seems to be working.<br><br>Please help me soon on how I might be able to do that.<br>Thank you.<br><br>I have display my code below please let me know.<br><br>Client Part<br><br>set IP 127.0.0.1<br>set SERVER_PORT 2766<br>set Socketid [socket -myaddr $IP $IP $SERVER_PORT]<br>fconfigure $Socketid -buffering line<br>fileevent $Socketid readable<br>set Fileid [open test1.c r]<br>while {-1 != [gets $Fileid Line]} {<br>puts $Line<br>puts $Socketid $Line <br>}<br><br>Server Part<br><br>set IP 127.0.0.1<br>set SERVER_PORT 2766<br>proc server_setup {Channel Ip Port} {<br> fileevent $Channel readable&nbsp;&nbsp;<br><br> set OutFile [open file.c w]<br> while {-1 != [gets $Channel Line]} {<br> #print file to the output file<br> puts $OutFile $Line<br> }<br> close $OutFile<br> <br> exec gcc -S -O0 file.c<br><br> fconfigure $Channel -buffering line<br> puts &quot;finished compilation&quot;<br>}<br><br>socket -server server_setup -myaddr $IP $SERVER_PORT<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top