TCP IP, client and server socket 
Author Message
 TCP IP, client and server socket

Aybody could explain to me about sending file/ data stream from a
client to a server through TCP/IP?
What's the procedure to use scott's library in my tcl script/ C program?

Actually, I have try these:

#####################
#open the file that's need to be sent to the server
set filename "myfile.txt"

#open socket : suppose localhost or server socket?
set sock [socket -async localhost 80]
fileevent $sock w {set connected 1}

#I'm not sure how to send the file
puts $sock $filename; #??

#how I know already connected and received the file??
global connected
vwait connected
####################
This code doesn't work just like waiting for sometime.
How can I check that the server already received the file?

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Mon, 12 May 2003 03:00:00 GMT  
 TCP IP, client and server socket
[fileevent ... writable ...] executes the command you give *every time* you can
write to that socket. You need to create a proc to turn the fileevent off
([fileevent ... writable {}]) and then set connected to 1.

-kl

Quote:

> Aybody could explain to me about sending file/ data stream from a
> client to a server through TCP/IP?
> What's the procedure to use scott's library in my tcl script/ C program?

> Actually, I have try these:

> #####################
> #open the file that's need to be sent to the server
> set filename "myfile.txt"

> #open socket : suppose localhost or server socket?
> set sock [socket -async localhost 80]
> fileevent $sock w {set connected 1}

> #I'm not sure how to send the file
> puts $sock $filename; #??

> #how I know already connected and received the file??
> global connected
> vwait connected
> ####################
> This code doesn't work just like waiting for sometime.
> How can I check that the server already received the file?

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Mon, 12 May 2003 03:00:00 GMT  
 TCP IP, client and server socket
I would recommend looking at the man pages/help files that came with
your Tcl distribution, and/or buying a good book, such as "Practical
Programming in Tcl/Tk" by Brent Welch. To create a server socket, use
[server -socket], and to connect to this socket use [socket ?host?
?port?]. To open a file, use [open $filename ?option?] where option is
one of r, r+, w, w+, a, a+ (?) I think. r is read, w is write, a is
append - check the docs. To write to a file or a socket, use [puts
?channel? ?data?]. To read from a channel use [read ?channel?] or [gets
?channel? ?var?]. To use the event loop to process these, use
[fileevent] and [fconfigure] with appropriate options (again, consult
the docs for usage). By the reference to port 80, I guess you are trying
to either read from a webserver, or set one up (???). To do either of
these you need to speak HTTP through the socket, which adds even more
complexity. Basically sit down with the docs for half a day and try lots
of examples, before trying to do this.

Hope this helps you.

Neil

Quote:

> Aybody could explain to me about sending file/ data stream from a
> client to a server through TCP/IP?
> What's the procedure to use scott's library in my tcl script/ C program?

> Actually, I have try these:

> #####################
> #open the file that's need to be sent to the server
> set filename "myfile.txt"

> #open socket : suppose localhost or server socket?
> set sock [socket -async localhost 80]
> fileevent $sock w {set connected 1}

> #I'm not sure how to send the file
> puts $sock $filename; #??

> #how I know already connected and received the file??
> global connected
> vwait connected
> ####################
> This code doesn't work just like waiting for sometime.
> How can I check that the server already received the file?

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Tue, 13 May 2003 08:13:32 GMT  
 TCP IP, client and server socket


Quote:
> [fileevent ... writable ...] executes the command you give *every
time* you can
> write to that socket. You need to create a proc to turn the fileevent
off
> ([fileevent ... writable {}]) and then set connected to 1.

> -kl




Quote:
> > Aybody could explain to me about sending file/ data stream from a
> > client to a server through TCP/IP?
> > What's the procedure to use scott's library in my tcl script/ C
program?

> > Actually, I have try these:

> > #####################
> > #open the file that's need to be sent to the server
> > set filename "myfile.txt"

> > #open socket : suppose localhost or server socket?
> > set sock [socket -async localhost 80]
> > fileevent $sock w {set connected 1}

> > #I'm not sure how to send the file
> > puts $sock $filename; #??

> > #how I know already connected and received the file??
> > global connected
> > vwait connected
> > ####################
> > This code doesn't work just like waiting for sometime.
> > How can I check that the server already received the file?

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

Thanks for reply. Anywhere, I really new to client server socket as
well as TCP/IP. Could you please give me an example then I can have a
better understanding in using tcl to fulfill my purpose?

Beside that, I would like to know whether I can control sending files
with the tcl script/ program only in either client side or sever side
(no need write programs at both side)?

Really appreciate for those willing to advise.

Sent via Deja.com http://www.deja.com/
Before you buy.



Tue, 13 May 2003 09:38:59 GMT  
 TCP IP, client and server socket

Quote:

> Aybody could explain to me about sending file/ data stream from a
> client to a server through TCP/IP?

http://starbase.neosoft.com/%7Eclaird/comp.lang.tcl/tcl-examples.html...

is basic example of transfering information through a
socket. Expanssion to transfer files should be simple.

--
Sincerely,

                <http://www.purl.org/NET/akupries/>
-------------------------------------------------------------------------------



Wed, 14 May 2003 02:22:28 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. TCP/IP sockets code in REXX script (long) - client.CMD (1/1)

2. TCP/IP sockets code in REXX script (long) - client.CMD (0/1)

3. C5 - TCP/IP Client/Server and DirectX Questions

4. TCP/IP server & client in CW2xxxx

5. Interest in TCP/Ip Server & Client

6. Client - Server slow tcp/ip...

7. TCP/IP sockets code in REXX script (long) - server.CMD (0/1)

8. does anyone have an example of a c++ TCP/IP client that works with labview TCP?IP server ??

9. CLIENT (Windows 3.1 or 95 or NT) to MVS-CICS via TCP/IP or other gateway

10. TCP/IP client app with MF COBOL?

11. Need help with TCP/IP client access from Windows

12. Announce: tkconnect - simple Tcp/ip client

 

 
Powered by phpBB® Forum Software