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!

how to send files through tcp/ip chat program

Status
Not open for further replies.

samibami

Programmer
Oct 12, 2003
28
0
0
IL
hi there,

i made a tcp/ip chat program and i want to add a "send file" option .i use bcb5 with fastnet's NMMsg and NMMsgSrv
components.this components have sendfile function.
but how do i use them?

 
In my opinion, you do not ask the correct question. You should ask, how to read a file and send correctly its data through the net, and how to read sent data, to create a new file and to write it correctly. I think you already know the responce, but anyway, I'll give you a short hint.

Through .NET you never send files, however sometines it looks like you do it. For example HTTP upload/download, mail attachment, FTP transfers, "send a file" through AOL/ICQ..., "copying files" in intranet. I'll name conventionally receiver the file consumer and the sender a file provider. I'll suppose some formats of data, also I suppose you have your own protocol what you will use instead. My protocol is not intended to be the most correct one, it is just an idea.
The scenarios is like follow:
1. File consumer request a file
("command=request_file;filename=xxxxx:"), or file consumer is notified that a file will be sent
("command=warning_file;filename=xxxxx;filesize=....:")
2. File consummer recive a confirmation
("command=accept;filename=xxxx;filesize=....:"), or file consumer sends such accept to file provider and provider just begins to send.
3. File provider opens the file and begins to read data and to send it through the net. File consumer receive many messages like
("command=file_send;filename=xxxx;data_from=...;bytes_num=....:file_data")
4. File consumer creates a file, reads file_data and write it in that file bytes_num bytes in the address data_from of the file.

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
you send it in wity bitty little chunks just like every
body else.

Programming Sockets in C
a very good book

tomcruz.net ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top