Click here to Skip to main content
15,909,498 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A very basic socket question Pin
includeh1017-Jul-02 3:39
includeh1017-Jul-02 3:39 
GeneralRe: A very basic socket question Pin
Dave_17-Jul-02 3:51
Dave_17-Jul-02 3:51 
GeneralRe: A very basic socket question Pin
includeh1017-Jul-02 4:05
includeh1017-Jul-02 4:05 
GeneralRe: A very basic socket question Pin
Dave_17-Jul-02 4:11
Dave_17-Jul-02 4:11 
GeneralRe: A very basic socket question Pin
Bubba214617-Jul-02 7:20
Bubba214617-Jul-02 7:20 
GeneralRe: A very basic socket question Pin
Dave_17-Jul-02 7:37
Dave_17-Jul-02 7:37 
GeneralRe: A very basic socket question Pin
Bubba214617-Jul-02 7:58
Bubba214617-Jul-02 7:58 
GeneralRe: A very basic socket question Pin
Dave_17-Jul-02 8:11
Dave_17-Jul-02 8:11 
We (here at my company) have talked about the reasons why the original programmer bound the sending port to 1594. I realize this is not the normal thing to do, but given that it is currently done this way, does the rest of it make sense?

We have officially "reserved" UDP 1594 for our systems, so that's why we are not randomly picking one. So when we send, we know that the units are going to reply to port 1594, since we know that we sent on 1594.

The only thing left to sort out is how the listening socket works. If it is bound with IN_ADDRANY, and port 0, there is next to no chance that it is picking 1594 (at least not every single time). So, given that it does actually get messages from 1594, I'm assuming that doing a rcvfrom on this type of bind will let me recv. from unkown port numbers, and not just 1594, since I never used the number "1594" anyhwere near the listeners source code.

This is where I am confused. Most people use sockets the way you described, where the client sends to a known server port, and things interact from there, but this is done differently. In this case, the PC sends most of the initial messages, and waits for replies, but it also collects messages from other ports, such as 502 (Modbus protocol).

I hope I am not sounding like I know more than you do, because I'm sure this is not true, but when it comes to the operation of the existing code, I do know that it works as I described. There are probably better ways to do it, however.

When I wanted to add a third socket to send a broadcast message, things didn't work, so I started to look further into it. The broadcast would go out each NIC, but the source IP was always the primary NIC's IP. So the new socket was created and bound to each NIC's IP, and port 0. The broadcasts were sent properly, but the replies were never seen by the listener. That's how I got to this point.

Sorry for the novel. I'll understand if you want to ignore me now.

Thanks again,

David.
GeneralRe: A very basic socket question Pin
Bubba214617-Jul-02 8:27
Bubba214617-Jul-02 8:27 
GeneralRe: A very basic socket question Pin
Dave_17-Jul-02 8:29
Dave_17-Jul-02 8:29 
GeneralPassing a control id Pin
moobob17-Jul-02 3:18
moobob17-Jul-02 3:18 
GeneralRe: Passing a control id Pin
Joaquín M López Muñoz17-Jul-02 3:21
Joaquín M López Muñoz17-Jul-02 3:21 
GeneralRe: Passing a control id Pin
moobob17-Jul-02 3:31
moobob17-Jul-02 3:31 
Questiondbdao.h : what is the matter now? Pin
includeh1017-Jul-02 3:13
includeh1017-Jul-02 3:13 
AnswerRe: dbdao.h : what is the matter now? Pin
Michael P Butler17-Jul-02 3:36
Michael P Butler17-Jul-02 3:36 
GeneralRe: dbdao.h : what is the matter now? Pin
includeh1017-Jul-02 3:46
includeh1017-Jul-02 3:46 
GeneralMemory Managment Pin
c_sisbit17-Jul-02 3:12
c_sisbit17-Jul-02 3:12 
GeneralRe: Memory Managment Pin
Joaquín M López Muñoz17-Jul-02 3:18
Joaquín M López Muñoz17-Jul-02 3:18 
GeneralRe: Memory Managment Pin
includeh1017-Jul-02 3:21
includeh1017-Jul-02 3:21 
GeneralRe: Memory Managment Pin
c_sisbit17-Jul-02 3:41
c_sisbit17-Jul-02 3:41 
GeneralRe: Memory Managment Pin
Joaquín M López Muñoz17-Jul-02 3:46
Joaquín M López Muñoz17-Jul-02 3:46 
GeneralRe: Memory Managment Pin
c_sisbit17-Jul-02 3:47
c_sisbit17-Jul-02 3:47 
GeneralRe: Memory Managment Pin
Joaquín M López Muñoz17-Jul-02 3:50
Joaquín M López Muñoz17-Jul-02 3:50 
GeneralRe: Memory Managment Pin
c_sisbit17-Jul-02 3:59
c_sisbit17-Jul-02 3:59 
GeneralRe: Memory Managment Pin
includeh1017-Jul-02 4:17
includeh1017-Jul-02 4:17 

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.