Page 1 of 3
Making TCP file sharing
Posted: Wed Aug 10, 2011 6:30 am
by Zelsoft
Hello im making a TCP File sharer where you can select a file from your computer and send it it another computer over the internet with a client and server. I saw a tutorial on youtube for it and it had the source so i made it but when i tryed to connect it, it gave me an error Help PLEASE
Video:
http://www.youtube.com/watch?v=b-F2UKzaSAk
Program that i made off it (Client and server) Below
Re: Making TCP file sharing
Posted: Wed Aug 10, 2011 6:35 am
by MrAksel
Cant you just connect straight client to client? The server part is always most difficult with TCP in my opinion.
Re: Making TCP file sharing
Posted: Wed Aug 10, 2011 12:32 pm
by mandai
You must have a listening server at one side if you want to use TCP sockets.
I wouldn't use the code from that video as the server may cause file corruption if the buffer contains less than 1024 bytes of data per write.
I'll post a transfer system based on my previous work, expect it later on today.
Re: Making TCP file sharing
Posted: Wed Aug 10, 2011 2:44 pm
by MrAksel
mandai wrote:You must have a listening server at one side if you want to use TCP sockets.
I wouldn't use the code from that video as the server may cause file corruption if the buffer contains less than 1024 bytes of data per write.
I'll post a transfer system based on my previous work, expect it later on today.
i didnt mean excluding the tcplistener, but just having both in the same program. Instead of one server computer and many clients.
Re: Making TCP file sharing
Posted: Wed Aug 10, 2011 2:47 pm
by MrAksel
You can also use the socket class and SendFile. The tcpclient/server classes are userfriendly "wrappers" for the socket class
Re: Making TCP file sharing
Posted: Thu Aug 11, 2011 1:35 am
by Zelsoft
Guys i have no idea what ur talking about lol sorry i dont got much expirence in this type of stuff im trying to learn but if you guys have some code that i can add to it to make it work or some stuff i need to do i would apriciate it
Re: Making TCP file sharing
Posted: Thu Aug 11, 2011 2:21 am
by mandai
Instead of one server computer and many clients.
You could run the server on different ports, that way it wouldn't have to be per machine.
Edit:
Removed code due to duplication.
The actual code can be found on page 3 (
here).
Re: Making TCP file sharing
Posted: Thu Aug 11, 2011 8:43 am
by Zelsoft
Thanks bro it work just 2 thing first is where dose it save the File???? and second is this online so if i give this to my friend and he types in my ip i can send him the file
Re: Making TCP file sharing
Posted: Thu Aug 11, 2011 10:04 am
by mandai
It will save/load the file from the current directory unless you change it.
You can use this online, but you will need to make sure any routers/firewalls are configured correctly.
Re: Making TCP file sharing
Posted: Thu Aug 11, 2011 5:18 pm
by Zelsoft
alright that's good but one more thing i have another problem (SORRY) umm when i click the client button it just like closes then after that it says server connection accepted from 127.0.0.1:51705 <------ not my ip?? and i click ok and another thing pops up says Unable to receive from client??? any help please