Making TCP file sharing

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
27 posts Page 1 of 3
Contributors
User avatar
Zelsoft
Top Poster
Top Poster
Posts: 99
Joined: Mon Aug 10, 2009 4:41 am

Making TCP file sharing
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
You do not have the required permissions to view the files attached to this post.
- WuSaMi Bringing the Pro in Programmers Once again
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: Making TCP file sharing
MrAksel
Cant you just connect straight client to client? The server part is always most difficult with TCP in my opinion.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Making TCP file sharing
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.
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: Making TCP file sharing
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.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: Making TCP file sharing
MrAksel
You can also use the socket class and SendFile. The tcpclient/server classes are userfriendly "wrappers" for the socket class
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
Zelsoft
Top Poster
Top Poster
Posts: 99
Joined: Mon Aug 10, 2009 4:41 am

Re: Making TCP file sharing
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
- WuSaMi Bringing the Pro in Programmers Once again
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Making TCP file sharing
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).
Last edited by mandai on Sun Jan 01, 2012 3:22 am, edited 4 times in total.
User avatar
Zelsoft
Top Poster
Top Poster
Posts: 99
Joined: Mon Aug 10, 2009 4:41 am

Re: Making TCP file sharing
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
- WuSaMi Bringing the Pro in Programmers Once again
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Making TCP file sharing
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.
User avatar
Zelsoft
Top Poster
Top Poster
Posts: 99
Joined: Mon Aug 10, 2009 4:41 am

Re: Making TCP file sharing
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
- WuSaMi Bringing the Pro in Programmers Once again
27 posts Page 1 of 3
Return to “Coding Help & Support”