|
-
Jun 3rd, 2001, 06:09 PM
#1
Thread Starter
Member
udp protocol...
Hey everyone, im having trouble with my winsock control.
I'm pretty familiar using winsock, as i have written a few chats, and other things with it that werent really useful.
The problem is, im trying to work with the UDP protocol this time, instead of the TCP Protocol. I've neve worked with the UDP before, and therefore im having a hard time trying to send data back and forth and debugging my program to see whats wrong. I kept a timer on the form that lets me know what state winsock is in, but it either only returns 0(Closed) or 1(Open). Im not really even sure how to make a connection with UDP, so any examples or help you can give me is appreciated. Thanks.
-
Jun 4th, 2001, 01:50 PM
#2
Thread Starter
Member
Thanks for your post Josh...
but, whats the point of having a UDP protocol then?
-
Jun 4th, 2001, 02:40 PM
#3
Black Cat
Stuff that doesn't need a connection. A good example would be streaming audio. The audio gets sent as packets, but if you don't recieve a packet of the audio, there's no point in re-request it as you've already heard the skip and the song kept playing. Windows networking uses this as well - when a computer starts it sends a "Hey, computer COMPNAME is on the network" message to the whole local network. It doesn't care who gets it or not and doesn't need a reply back.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Jun 5th, 2001, 04:27 PM
#4
Thread Starter
Member
Josh...that was kinda what i wanted to...only, not sending audio.
I heard that UDP was for sending packets...thats what i wanted to do, i wanted to make a basic file-sharing program...but theres something wrong with it i think, because it wont send the data...unless im doing something wrong...if you want me to upload the form and take a look at it for yourself, let me know...thanks again.
-
Jun 6th, 2001, 08:24 AM
#5
Frenzied Member
Josh is right, UDP is connectionless, and it has a great use in streaming media and system announcements. That is actually when I run into it the most is when a program needs to wideband data. It will broadcast it across the network on half a dozen UDP ports. It doesn't care if anyone gets it, and it doesn't care how many people get it.
There is a systems monitoring tool, Candle Command Center, that uses agents on remote host to monitor some application or system function. The hub and the agents communicate via UDP, this way the hub doesn't have to explicitly send a message to each agent in the field, it can send the message once and all the agents listening can hear it. The agents likewise can broadcast so the hub and its back up can both hear it. Besides, if the agent is talking, there is a problem, and the problem may be network related, so there is no need to spend time trying to set up a connection if the network might be down. If it goes through, great, if not, well the agent will miss the next "I'm alive" poll from the hub and will be reported as offline to the sys admins who are monitoring.
Anyway, I wouldn't use UDP for file sharing unless you didn't want to worry about security and you had several servers that were trying to keep in sync.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Jun 6th, 2001, 02:53 PM
#6
Thread Starter
Member
CiberTHuG, are you suggesting I use TCP then to send the file?
Im pretty sure the code I wrote is right, and if it isnt I most likely could fix it since I've had experience using TCP connections before...
Thanks for replying, once again 
PS: Josh, whats your suggestion?
PSS: Anyone else have a suggestion?
-
Jun 7th, 2001, 06:59 AM
#7
Black Cat
I agree with CiberTHuG - use TCP.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Jun 7th, 2001, 07:48 AM
#8
New Member
I to agree, use TCP.
I'm making an ActiveX so that I easily can send and recive files over the net.
And you have experience of winsock so you know how to do.
The only thing is that you must divide up the files into packets and then send them.
Do you know how many bytes winsock can send in one package?
I guess I will have to test it out...
-
Jun 7th, 2001, 03:39 PM
#9
Thread Starter
Member
thanks once again for responding 
thomas...im pretty sure winsock can send as many bytes as needed in one package, since i use a file sharing program that was made in vb---with a cable modem, ive seen speeds of 260 kb p/sec and greater .... i guess that answers your question
-
Jun 8th, 2001, 03:33 PM
#10
New Member
I tested winsock and the largest package it can send in one turn is 8192 bytes. But when i tested sending 20000 bytes it kept on sending until it had sent all 20000 bytes, so I don't know if Microsoft has baked in a function that splits the package into right sizes or if it has been there all the time... I use the latest service pack so I don't know...
I to have got up to about 230 kb/s... But I'm testing now if I can use multiple winsocks to send same file thrue multiple ports and so on...
If you want to know something you must test it if it works
-
Jun 8th, 2001, 07:50 PM
#11
Thread Starter
Member
Thomas, yesterday I was wondering why when I sent a 7kb file, it turned into 41 kb - ALWAYS, if it were anything under 41. I then realized that i mistaked PacketSize for BaudRate .... speaking of BaudRate, is there a way to get it? Im not sure of how you would get the baud rate of the file being sent, but I sent myself a 3meg file last night @ 2kb packet size and received it in about 10 seconds...someone wanna help me -- yet AGAIN?
-
Jun 9th, 2001, 03:46 PM
#12
New Member
-
Jun 11th, 2001, 06:53 AM
#13
Thread Starter
Member
Thomas, that kindof helped...I didnt understand what you meant by a division by zero error, although I saw where the error would take place....I haven't been working much on this lately, but ill get around to it in about a week or so ( hopefully :\ ) I didnt put that code in vb either so i guess that would have helped if I tried that. heh well, hmprgh, keep posting I guess heh
-
Jun 11th, 2001, 01:12 PM
#14
New Member
-
Jun 11th, 2001, 05:47 PM
#15
Thread Starter
Member
Thomas, heh, I haven't had much time with programming lately, like I said in my last post, I'll be getting around to it in a week or so (yet i have enough time to write this post heh) ... I understood the division by zero before you posted that...I just meant i never saw that error before...I'll start posting on this thread again once I get back into finishing that thing...keep on posting and ill keep on checking back heh
-
Jun 12th, 2001, 11:08 AM
#16
Addicted Member
Sharing files and copying them safely is a major pain, expecially with dropped packets and resuming.. The easiest(And I do stress easiest, this isnt the best way) way is to use directplay, which can automatically deal with packets and streams.. Winsock has the problem of receiving streams in pieces, then you need to do work to put them back together again, particularly on multiple connections. Directplay just does it for you, making sure nothing is lost, and that the data doesnt get mixed up..
-
Jun 12th, 2001, 11:57 AM
#17
Thread Starter
Member
Directplay? im guessing thats something with DirectX ... which I've never used before so i have no clue how it works :\
If you want to leave me an example, feel free to...
I'm using DX7 though, I think... heh
-
Jun 12th, 2001, 12:31 PM
#18
New Member
I always use Winsock and I haven't got any problems yet...
But I will see if problems occour when I have modified my code so that I can use multiple connections
I have never heard of directplay, but as you said it seems to be some DirectX thing.
But I will probably stay with winsock and packages
Well, see ya!
-
Jun 12th, 2001, 05:20 PM
#19
Thread Starter
Member
I haven't had problems with winsock either Thomas...
since I'm more familiar with it, ill probably stick with it anyways.
thanx for the feedback, as usual, and keep posting heh 
ill be getting back to programming soon, I'll let you guys know when
-
Jun 13th, 2001, 04:09 AM
#20
Addicted Member
Directplay is made for what your doing, if you send a file, directplay makes sure it gets there, in one peice, in the right order, and allows you to resume it. With Winsock you need to code all that by hand... But, its your choice, directplay doesnt go cross platform, but it is compatible with directX4, so long as you use old code.
-
Jun 13th, 2001, 11:18 AM
#21
Thread Starter
Member
tonyenkiducx, i would appreciate an example of how to use this, since i've never worked with it before, if you have time to write one...even though i might not end up using that code.
thanks for the feedback 
this is like the highest viewed thread ive seen on the ASP, VBScript, Internet and Network Development I've seen...good job heh
-
Jun 13th, 2001, 12:48 PM
#22
New Member
Well, I'm allmost ready with my changes in my code, and I'm connecting with multiple winsocks now
And it works good, but I'm only getting speeds up to 250-300 kb/s... But that's not to bad
I guess it's the DoEvents command that slows it down...
But I don't use it to much but it slows things down anyway...
See ya!!
-
Jun 13th, 2001, 01:20 PM
#23
Thread Starter
Member
Thomas, what kind of connection are you on? heh, i think 250kbps would be good enough for me I was using DoEvents in my coding...But then again I havent really worked on it for a while, but im getting back to it...sooner or later...hehe
-
Jun 14th, 2001, 02:03 PM
#24
New Member
-
Jun 14th, 2001, 02:56 PM
#25
Thread Starter
Member
heh good job 
i dont prefer DSL, I find it veryyyyyyyy slow.
but then again its not my choice 
a couple more days and ill get back to programming that...
porobably on monday/tuesday
-
Jun 15th, 2001, 12:11 PM
#26
New Member
-
Jun 15th, 2001, 01:25 PM
#27
Thread Starter
Member
yeah, anything's better than 56k.
heh, how can you get 10megs p/sec with DSL?
...weird. anwyays, happy programming to you too heh 
monday comes in 3 days...
-
Jun 15th, 2001, 04:00 PM
#28
New Member
-
Jun 16th, 2001, 01:23 AM
#29
Addicted Member
Just a comment regarding DirectPlay:
It has it's upsides and downsides, but I would recommend sticking with Winsock at this stage, for a couple reasons:
1) As someone previously mentioned, it isn't cross-platform, and that's a big deal if you send to a major web server/computer on the internet (odds are it's a *nix varient)
2) You do know Winsock, and that's a great thing...but one can always learn more Having DirectPlay encapsulate functions is a great thing, but not only will you learn more but you'll have more control over what you're doing
3) If you distribute your apps, you're asking every user to have at least DirectX-whatever on their computer, and it's just one more thing for your user that they don't want to have to do
Just my two (well, three!) cents
Things I've Said:
"Life's funny like that...elephants can wear frilly lace panties, and Dubya still looks like a monkey in a big chair"
"Take four goats and strap one to each foot of a llama. Presto, goat-powered llama!"
"You want to get me to work more, get me a Coke. No? Then deal with inferior garbage, I'm not coding another line and your clients can go to......thanks, I'd love a Coke right about now!"
-
Jun 16th, 2001, 08:26 AM
#30
Thread Starter
Member
thanks for the feedback csammis....
I plan to eventually learn all this stuff heh
but for now, im stuck on stupid problems.
i know this doesnt have to do with networking development & so forth, but im having trouble saving a treeview...
take a look at my post:
http://161.58.186.97/showthread.php?s=&threadid=83371
-
Jun 16th, 2001, 12:18 PM
#31
Addicted Member
Looking right now...I think I see the error...
Things I've Said:
"Life's funny like that...elephants can wear frilly lace panties, and Dubya still looks like a monkey in a big chair"
"Take four goats and strap one to each foot of a llama. Presto, goat-powered llama!"
"You want to get me to work more, get me a Coke. No? Then deal with inferior garbage, I'm not coding another line and your clients can go to......thanks, I'd love a Coke right about now!"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|