Sending File Through UDP
-
Thanks folks for your valuable advice of Tcp over Udp. As far as my requirements are concerned, it demands UDP. Bcoz the scenario is such that we have to broadcast packets at the same to n number of Machines across the network.That's the reason i need help on Sending files over UDP protocol. I have worked previously on TCP,but not on UDP. As far as previous post is concerned,somebody said that it is similar as creating Socket and Sending it using IP and Port. I hope in UDP you are sending on a Broadcast IP and port,so how to do it. Thankx in Advance.
Girish Software Developer
-
Thanks folks for your valuable advice of Tcp over Udp. As far as my requirements are concerned, it demands UDP. Bcoz the scenario is such that we have to broadcast packets at the same to n number of Machines across the network.That's the reason i need help on Sending files over UDP protocol. I have worked previously on TCP,but not on UDP. As far as previous post is concerned,somebody said that it is similar as creating Socket and Sending it using IP and Port. I hope in UDP you are sending on a Broadcast IP and port,so how to do it. Thankx in Advance.
Girish Software Developer
Girish601 wrote:
I hope in UDP you are sending on a Broadcast IP and port,so how to do it.
Create the socket with a call to
CSocket::Create
and set thenSocketType
parameter toSOCK_DGRAM
for UDP. If the socket was successfully created you can useCSocket::SendTo
for sending datagrams to whatever address and port you desire since both shall be provided as formal parameters. If you're not using MFC you can use the raw socket API, but I think you get the picture. Hope this helps -- Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998
"...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above -
Thanks folks for your valuable advice of Tcp over Udp. As far as my requirements are concerned, it demands UDP. Bcoz the scenario is such that we have to broadcast packets at the same to n number of Machines across the network.That's the reason i need help on Sending files over UDP protocol. I have worked previously on TCP,but not on UDP. As far as previous post is concerned,somebody said that it is similar as creating Socket and Sending it using IP and Port. I hope in UDP you are sending on a Broadcast IP and port,so how to do it. Thankx in Advance.
Girish Software Developer
It is very similar, except that datagrams (UDP messages) have a maximum size, and there is no guaranteed delivery or sequencing/ordering of data. With TCP, if you send 128KB of data with a single call, internally it will be broken up (if necessary) into smaller packets (either on your system or possibly further down the network) that will be reassembled on the receiving system. With UDP, IIRC, if you try to send 32KB with a single call, only a certain amount of it will be sent (something like 1500 bytes, I think). You will need to break up the data yourself into packets and send them one at a time. Additionally, if you send 5 packets in a row (
1,2,3,4,5
), they may arrive on the other side out-of-sequence (1,2,_**4,5,3**_
), or some may not make it at all (1,3,**_4,2_** but no 5th datagram
). Sending multiple-packets of data via UDP often requires that you implement your own packetizing logic so that you handle lost or out-of-sequence packets. Broadcast, point-to-point, point-to-multipoint or multicast has nothing to do with your using TCP or UDP, IIRC. You can data using either style to a broadcast address (i.e. xxx.xxx.xxx.255), or to a multicast address (multicast router, for example). Peace!-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
Thanks folks for your valuable advice of Tcp over Udp. As far as my requirements are concerned, it demands UDP. Bcoz the scenario is such that we have to broadcast packets at the same to n number of Machines across the network.That's the reason i need help on Sending files over UDP protocol. I have worked previously on TCP,but not on UDP. As far as previous post is concerned,somebody said that it is similar as creating Socket and Sending it using IP and Port. I hope in UDP you are sending on a Broadcast IP and port,so how to do it. Thankx in Advance.
Girish Software Developer
Girish601 wrote:
I have worked previously on TCP,but not on UDP. As far as previous post is concerned,somebody said that it is similar as creating Socket and Sending it using IP and Port.
No big difference. It still requires port & IP.
Girish601 wrote:
I hope in UDP you are sending on a Broadcast IP and port,so how to do it.
It's not "in UDP we broadcast". Broadcast is done if we want to. For sending files I dont think UDP would be the best option. But in LAN environment, it's success rate is 99%. The main difference is, it's connectionless protocol that means it doesn't maintain any connection between the server & client. Just "push" the data and "get" the data. No connection path is set up in between. let me give you a link ..please wait.
Code-Frog:So if this is Pumpkinhead. Time for him to run and hide. It's an interesting thought really.
-
It is very similar, except that datagrams (UDP messages) have a maximum size, and there is no guaranteed delivery or sequencing/ordering of data. With TCP, if you send 128KB of data with a single call, internally it will be broken up (if necessary) into smaller packets (either on your system or possibly further down the network) that will be reassembled on the receiving system. With UDP, IIRC, if you try to send 32KB with a single call, only a certain amount of it will be sent (something like 1500 bytes, I think). You will need to break up the data yourself into packets and send them one at a time. Additionally, if you send 5 packets in a row (
1,2,3,4,5
), they may arrive on the other side out-of-sequence (1,2,_**4,5,3**_
), or some may not make it at all (1,3,**_4,2_** but no 5th datagram
). Sending multiple-packets of data via UDP often requires that you implement your own packetizing logic so that you handle lost or out-of-sequence packets. Broadcast, point-to-point, point-to-multipoint or multicast has nothing to do with your using TCP or UDP, IIRC. You can data using either style to a broadcast address (i.e. xxx.xxx.xxx.255), or to a multicast address (multicast router, for example). Peace!-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFilesJames R. Twine wrote:
Broadcast, point-to-point, point-to-multipoint or multicast has nothing to do with your using TCP or UDP, IIRC. You can data using either style to a broadcast address (i.e. xxx.xxx.xxx.255), or to a multicast address (multicast router, for example).
I'm currently doing some research on broadcast and multicast, as we plan to use it in one of our projects. All documents I found so far claim that broadcasing and multicasting require the use of UDP. This does make sense to me, as TCP requires an established connection and for broadcasing and multicasting you don't even know to how many recepicients you are talking.
Regards, Tim
-
James R. Twine wrote:
Broadcast, point-to-point, point-to-multipoint or multicast has nothing to do with your using TCP or UDP, IIRC. You can data using either style to a broadcast address (i.e. xxx.xxx.xxx.255), or to a multicast address (multicast router, for example).
I'm currently doing some research on broadcast and multicast, as we plan to use it in one of our projects. All documents I found so far claim that broadcasing and multicasting require the use of UDP. This does make sense to me, as TCP requires an established connection and for broadcasing and multicasting you don't even know to how many recepicients you are talking.
Regards, Tim
Tim Paaschen wrote:
All documents I found so far claim that broadcasing and multicasting require the use of UDP. This does make sense to me, as TCP requires an established connection and for broadcasing and multicasting you don't even know to how many recepicients you are talking.
Interesting... I think that makes sense for things like using PING to try to ping a broadcast address, but not for multicast that is supported by the network hardware. Since one or more routers could handle connetions to multiple clients, and since the connections are one-way, connection or connection-less would not matter - clients would subscribe to the 'cast by subscribing to the multicast server. But then again, I have not been close to multicast for some time now, so my memory of it may be faulty. Peace!
-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles