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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending text from a file to a client program

Status
Not open for further replies.

zerobarrier

Programmer
Sep 16, 2000
1
0
0
US
Hello,
I have been trying to do this for a while. I am trying to send text from a file on the server computer, to the client program, and have the text display in a text widget.

This is part of my server application code:
set parser [interp create -safe]
$parser eval {
proc get_news {} {
set fid [open archive/test.eif "r"]
set a [read $fid]
close $fid
return "show_news $a"
}

}

I want it to send the contents of "test.eif" to the client. I can connect to the server alright with the client, but it doesnt receive the text. Please help me. Thanks [sig][/sig]
 
send only works if the wish interpreters share a display.

I'm assuming you have control of the sockets on both the server and on the client.

You can send line by line and stop when you get to eof. The only way I've found to do this (and I'm by no means an expert) is for the server to close the socket.

One other way I've done it is to regsub all the newlines in the file with some other obscure character and send the file as one big line. With the socket buffering set to line, you can transfer files and keep the socket open.

Good luck,

Jeff.
 
If you close the sending end, all output will be flushed. But if you are leaving the socket open, then you need to do a flush command after the IO to make sure all output is sent immediately.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top