File transfer

TomTom

New member
Joined
Dec 30, 2004
Messages
3
Programming Experience
Beginner
I got a litlle problem.
I got a client and a server application, they can connect to each other on a certain port.
Thy can both stream text to each other.
But the issue i got, is that it is a multi user application, kind like a chat application, but i have to send files from the server to a client.
Now i'm not knowing how to send xml files through a stream to a client.

I know it's a really stupid problem, who can be easily solved i think.
But i can't find how file streaming is working on the tcp/ip.

Anyone who can help me ?

Thx

Tom
 

kanak

Member
Joined
Jan 9, 2005
Messages
17
Programming Experience
Beginner
hi tom ..i have used transfeering file with text content in my client server application ... its very easy if u r tryin to send the file whose content is text ...

u can open the file using file.io.opentext("filename")

use string str= streamobject.read to end
now when u have got the content in a string ...
u can use system.text.ascii.getbytes() to convert the string into byte stream...


using sockets in TCP/IP u can only send data as byte stream ... so when u get the bytes ... u can use ur socket to send it to the server
socket.send()

and get it in the server .. and convert it into a string and use the filestreamwrites write method to write it into a file

its as easy as such

message me if u succeed or still have any prob .. i might be able to help u with code ... but only after some time as my computer has gone for a repair
 
Last edited:
Top Bottom