Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 30th, 2006, 3:04 PM   #1
dmitry_k53
Newbie
 
Join Date: Apr 2006
Location: Canada
Posts: 1
Rep Power: 0 dmitry_k53 is on a distinguished road
Send a message via MSN to dmitry_k53
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
dmitry_k53 is offline   Reply With Quote
Old May 19th, 2006, 1:13 PM   #2
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3 kruptof is on a distinguished road
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"
kruptof is offline   Reply With Quote
Old May 20th, 2006, 1:42 PM   #3
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
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.
Booooze is offline   Reply With Quote
Old May 20th, 2006, 3:27 PM   #4
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3 kruptof is on a distinguished road
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.
kruptof is offline   Reply With Quote
Old May 20th, 2006, 5:16 PM   #5
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
What a stupid rule... why reinvent the wheel unless you're going to make it better?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old May 20th, 2006, 5:18 PM   #6
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
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
Mjordan2nd is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:08 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC