![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
|
Sending files via winsock
hey all
i am wondering if any1 is willing to walk me through a tutorial on sending files (such as ".exe") via winsock. I know winsock... somewhat, i was able to make a person-to-person chat that just sends text and a multiple user chat that connects to a single server. so now, i want to go further, and find out how i can make a sorta P2P like program. -thnx (in advance) for any help |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3
![]() |
i have done a similar project out of bordem as well.......it was kinda good when i finished but i couldn't master how to perfect the audio part.
Here is what you do: 0.tell the the reciever(not the person the program) that you are sending a file and provide them with the files name and extension and send them an "open command" 1.open th file for reading. 2.read say about 8000,bytes of the file 3.put it into a string 4."data" + send that string 3.use DoEvents 4.loop until you reach the EOF 5. when reach the EOF send a "fini" message at the recieving end 0.get the first four letters of the received message and store it in "command" 1. if the command ="open" then create a file with the specificed extension...........or just open the file for write(i think if it doesn't exsist it will be created) 2. if command ="data" then then put the data that you received in into the file that you just created (using the file number) 3.if command="fini" then close the file hope this help: there is also a wealth of information on this if you google the "VB winsock file transfer" |
|
|
|
|
|
#3 |
|
Expert Programmer
|
This is my favorite way of transfering files over winsock in vb. Seems to be the fasted and uses the smallest amount of code too. Always wished I had have found it out sooner :p
http://a1vbcode.com/app-82.asp Great little app. Totally worth the download. |
|
|
|
|
|
#4 |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3
![]() |
unless you have made that and uploaded that Booze then i am dissapointed that you would use that program when you can create it yourself( it does say on your languages profile VB),Here is a rule if you can programm it don't download it or buy. that goes for all the little apps such as the file you specified above, media players, text editors and etc.......................basically if you can make it yourself why use some one elses work because if you made it your self you know what it is exacly doing.
|
|
|
|
|
|
#5 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
What a stupid rule... why reinvent the wheel unless you're going to make it better?
|
|
|
|
|
|
#6 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
I somewhat agree with Ooble. If you're rewriting something from an educational standpoint, I can understand that, but why would you want to rewrite everything when it is already available to you otherwise?
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|