Click here to Skip to main content
15,921,697 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralString Conversion Pin
Frank Deo8-Sep-03 6:53
Frank Deo8-Sep-03 6:53 
GeneralRe: String Conversion Pin
Dominik Reichl8-Sep-03 7:01
Dominik Reichl8-Sep-03 7:01 
GeneralRe: String Conversion Pin
David Crow8-Sep-03 7:19
David Crow8-Sep-03 7:19 
GeneralRe: String Conversion Pin
Frank Deo8-Sep-03 7:38
Frank Deo8-Sep-03 7:38 
Generalmultiple return values Pin
manusha8-Sep-03 6:45
manusha8-Sep-03 6:45 
GeneralRe: multiple return values [C#] Pin
Dominik Reichl8-Sep-03 7:04
Dominik Reichl8-Sep-03 7:04 
GeneralUDP client implementation Pin
NewHSKid8-Sep-03 6:39
NewHSKid8-Sep-03 6:39 
GeneralRe: UDP client implementation Pin
geo_m9-Sep-03 7:40
geo_m9-Sep-03 7:40 
Well, during the creation you just pass the SOCKET_DGRAM instead of SOCKET_STREAM.
Then you might 'bind' it to the local port (selecting the client side port number - unusual in tcp). If you don't do it it will choose the port automatically as in tcp, but most udp protocol expects also known client port, so usually you have to do it.

Then the usage is slightly different - on write side whatever you write it will send a packet immediatelly (no nagle alg. as in tcp) therefore if you write every byte separately, there will be separate packet for every byte (thus big overhead). You also have to specify the destination address - this is in tcp taken from the 'connect', but there's no connect, because it's connectionless socket Wink | ;) .

Reading part - here you can use the recvfrom or WSARecvFrom functions which returns also the address from where the datagram was sent and you can process it.

That's the difference between udp and tcp - in udp you can communicate with several computers using one socket. Therefore you have to specify the address in write and receive it in read.

Another issue with udp is that it's not reliable - it's only best effort service, so during design of the protocol you have to think about the fact, that the packets (data) can be lost - this is normally controlled by tcp and in that case the data are resend, but it's not valid in udp, here it's up to you.

That's just brief description of udp-tcp differences. I hope it's not too much confusing Wink | ;-)
GeneralDocument/view stops working with CSplitterWnd... Pin
iNsAn1tY8-Sep-03 6:05
iNsAn1tY8-Sep-03 6:05 
GeneralRe: Document/view stops working with CSplitterWnd... Pin
iNsAn1tY8-Sep-03 23:20
iNsAn1tY8-Sep-03 23:20 
GeneralCD ROM detection Pin
Nigel Gooch8-Sep-03 5:54
Nigel Gooch8-Sep-03 5:54 
GeneralRe: CD ROM detection Pin
David Crow8-Sep-03 8:03
David Crow8-Sep-03 8:03 
GeneralRe: CD ROM detection Pin
Nigel Gooch8-Sep-03 21:39
Nigel Gooch8-Sep-03 21:39 
Generalattach the dialog to the tab Pin
Jeef8-Sep-03 5:33
Jeef8-Sep-03 5:33 
GeneralRe: attach the dialog to the tab Pin
Jeef8-Sep-03 16:06
Jeef8-Sep-03 16:06 
Generalerror in executing c++ code Pin
ranjjj8-Sep-03 4:58
ranjjj8-Sep-03 4:58 
GeneralRe: error in executing c++ code Pin
David Crow8-Sep-03 5:43
David Crow8-Sep-03 5:43 
GeneralRe: error in executing c++ code Pin
Michael P Butler8-Sep-03 6:07
Michael P Butler8-Sep-03 6:07 
GeneralRe: error in executing c++ code Pin
ranjjj8-Sep-03 18:09
ranjjj8-Sep-03 18:09 
GeneralRe: error in executing c++ code Pin
Michael P Butler9-Sep-03 9:34
Michael P Butler9-Sep-03 9:34 
GeneralChange color group box border Pin
JensB8-Sep-03 4:33
JensB8-Sep-03 4:33 
GeneralRe: Change color group box border Pin
valikac8-Sep-03 9:57
valikac8-Sep-03 9:57 
GeneralRe: Change color group box border Pin
JensB9-Sep-03 2:24
JensB9-Sep-03 2:24 
GeneralRe: Change color group box border Pin
valikac9-Sep-03 20:04
valikac9-Sep-03 20:04 
GeneralCPen with thick dotted lines Pin
BadJerry8-Sep-03 3:31
BadJerry8-Sep-03 3:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.