Hi!
I was make Multi-Chat program (server/client) you can download it here .
Now I wonna make file send but I don't know how can anyone help me?
sorry for bed english! :bigyello:
Printable View
Hi!
I was make Multi-Chat program (server/client) you can download it here .
Now I wonna make file send but I don't know how can anyone help me?
sorry for bed english! :bigyello:
Have you included DCC chat in your program? If so, send and receive the file using DCC.
No I did't include dcc chat. How I can include dcc chat?? you can download source of chat here
You have to develop some protocol for file sending - dcc is just one such protocol. You could change each byte to 2 bytes, the hex equivalent of the character, which is how it used to be done on Usenet, or you could send them as is - which you do depends on how you develop the protocol. IOW, 'A', being 41 hex, would be sent as '41', etc. You'd also want to send a header with the total file size and file name, date and any other info you're sending.
It could be as simple as just a "the following is a file - don't display it" header, followed by a filename, date, size header, followed by 1k (or 2k or 4k) chunks of file, until the entire file has been sent.
The receiver, on receiving the first 2 headers, would pop up a message saying that user X wants to send file Y and asking the user if he wants to receive it. If he says yes, the program sends a "go ahead" header, and the file gets sent. If he says no, a "cancel the transfer" header gets sent, the sender is advised that the receiver doesn't want the file and the transfer is aborted.
The headers could be anything - 01 = this is a file transfer, 02 = go ahead, 03 = cancel, etc.
I've made tons of chat/file transfer programs but that was awhile ago and I don't have any code lying around. There is some code in the code bank though.
But Al42 described the basic process pretty well.
Edit: I found some code I put on PSC awhile ago but that was back when I wasn't as experienced with Winsock, but it still works.
Here's a simple 2-way chat with file transfers:
http://www.pscode.com/vb/scripts/Sho...46633&lngWId=1
And a Remote File Manager that has a few bugs but the file transfers should still work.
http://www.pscode.com/vb/scripts/Sho...50253&lngWId=1
It comes with a file sender/receiver control that I made and you can either use in your program or learn from it and make your own.
I've since learned better ways to do it so you may want to take what you can from it and change the rest.
ok thx I will try now to make file transfer.