Conceptual query with Getaddrinfo method - winsock2

When using the getaddrinfo method, I'm providing an IP address and the port number. I'm getting a linked list in the out variable. It works fine. But I have a conceptual doubt here. When i am giving both the IP address and port, how is it there are so many possible sockets returned? Shouldnt there be only one?

From the getaddrinfo man page:
There are several reasons why the linked list may have more than one
addrinfo structure, including: the network host is multihomed,
accessible over multiple protocols (e.g. both AF_INET and AF_INET6);
or the same service is available from multiple socket types (one
SOCK_STREAM address and another SOCK_DGRAM address, for example).
Normally, the application should try using the addresses in the order
in which they are returned. The sorting function used within
getaddrinfo() is defined in RFC 3484; the order can be tweaked for a
particular system by editing /etc/gai.conf (available since glibc
2.5).

Related

How to discover other domain hosts using rtps_discovery

Recently, I try hard to use OpenDDS SSL in WAN network. But All my attempts to failed.
This is caused by the inability to find different hosts.
I realized one thing. OpenDDS security should use rtps_discovery, not InfoRepo, and it is difficult to find two hosts in different subnetworks via rtps_discovery.
I have been searched about discovering host by rtps_discovery option from SourceForge, github, and stackoverflow. But, No one successed in this manner.
https://sourceforge.net/p/opendds/mailman/message/36320180/
https://github.com/objectcomputing/OpenDDS/issues/854
So, my question is how to find the host using rtps_discovery on the WAN network.
here is my ini file:
[common]
DCPSGlobalTransportConfig=$file
DCPSSecurity=1
[domain/4]
DiscoveryConfig=uni_rtps
[rtps_discovery/uni_rtps]
SedpMulticast=0
ResendPeriod=2
SpdpSendAddrs=publisher's IP:56789
[transport/the_rtps_transport]
transport_type=rtps_udp
use_multicast=0
local_address=subscriber's IP:55555
please give me some ideas to solve this problem
It is really impossible to discover hosts in different subnetworks via rtps_discovery??
I'm finally success to communicate using rtps discovery!
It just SpdpSendAddrs attribute set 8410 port.
like this:
[common]
DCPSGlobalTransportConfig=$file
DCPSSecurity=1
[domain/4]
DiscoveryConfig=uni_rtps
[rtps_discovery/uni_rtps]
SedpMulticast=0
ResendPeriod=2
SpdpSendAddrs=subscriber's IP:8410
[transport/the_rtps_transport]
transport_type=rtps_udp
use_multicast=0
But, new question is that how to confirm this security function work properly??
When I capture packet by wireshrk, I can see the data not encryped.
I used OpenDDS Messenger security example.

Labview: error in accessing server addres space

I am trying to access the server address space and I am getting this Error.
LabVIEW: (Hex 0xFFFA8EBB) The node path refers to a node that does not exist in the server address space
The server is on a Plc and I am connected via Lan. the information i have is
Server-URL: opc.tcp://192.168.1.135:4840
Namespace-URI: urn:B&R/pv/
I have tried different things but i am not sure how to access the variables in address space. any suggestions would be helpful
B&R Publishes the Endpoints of your data in a fairly consistent manner. If you use a OPC UA browsing tool, you will find that the address space visible to Labview should start with
PLC.Modules.<Default>
B&R Automation Studio requires that you complete the default OPC UA configuration. Within that configuration you would need to enable the nodes/endpoints in question. You can then access these nodes in Labview.
You should check the following:
Under your controller, confirm that you have enabled OPC UA in the
configuration view.
Next, check that you have added a OPC UA Default View File to your
configuration for the hardware you are running.
Finally, in that file, ensure that you have enabled the endpoint/variable and that
it has at least the read permission. The quickest and most expedient
way is to ensure that you have gone to the top level of the OPC UA
Default View File and added the Everyone role and that Read is
enabled. This will cascade down to all enabled endpoints.
Save this and make sure it has been built and added to your controller. You should be able to access endpoints then.
For example, if I have a program called "LampController" running in B&R with a variable called switchState it would be addressed by:
PLC.Modules.<Default>.LampController.switchState
You need to use %26; in place of an ampersand. The ampersand is used to delimit the URI from the query segment. It's pretty unusual to even have an ampersand in a URI. Are you sure you typed it right?

Memory Address Range - F7FFF000 converted to what command line option?

First, appreciate you giving this a look. I have an ancient piece of software that writes old Linear PCMCIA cards. In my case, I want to use it in a specialized piece of gear called a Tech2. The software in question is called Memory Card Explorer. Now, I know for a fact it works in Windows XP with Native PCMCIA slots. However, I have a slot that is built on a Dual Systems adapter (basically an Expresscard to PCMCIA adapter).
The issue arises when following the instructions on installation issues, the program refuses to locate the Dual Adapter. Here's the example given in the manual:
"Use a similar address to the PCMCIA adapter. That address can be found using msinfo32.exe.
Eg: if the PCMCIA socket has a memory resource of F8000000 then use a MCE window command of F80D0000 using command line option of WF80D0."
So I get my adapter address which is F7FFF000 but have no idea where to add the "d" to the resource address then change it to a command. I've tried WF7FD0. Am I missing something simple in how these addresses are truncated for command line? Is there a calculator that does the conversion for you somewhere?
Thanks.
It looks like the pattern is to add 0x000D0000 to the address, take the five high nibbles of the address (which makes sense, since these sorts of addresses are typically page-aligned the bottom 3 nibbles will always be 0 on a system with 4KiB pages), and prepend 'W'. Try WF80CF.

Can't remove UPnP port mapping

I was messing around with a UPnP library which I'll be using for a game server. I came to a point where I had to make my addPortMapping-function fail somehow, but since I don't have direct access to the router, I can't turn off UPnP in order to make it fail.
What I did try, in order to make the function fail (which ultimately it didn't), was to try to add a port mapping to port -1.
Now I have the problem of not being able to remove a port mapping from the router to my computer on port -1...
As ports can't be < 1, this confuses me.
Is this a known problem?
WANIPConnection:2 specification defines both externalPort and internalPort as "ui2" so they're unsigned integers 0-65535 (internalPort also can't be 0, which is used as wildcard for externalPort). If an implementation accepts -1 it's just broken: So this is not a known problem but a bug in your router. Buggy UPnP-IGD routers in general are a known problem so this is not a surprise.

Change IP Address using Visual Basic

How can you change your IP Address using visual basic please? I havnt been able to find anything useful anywhere so i was just wondering if I could get some help on here?
Im not onabout the external Ip address. I know that cannot be changed(I have a static one from my isp.) Im onabout changing the internal ipaddress... for example changing from: 192.168.1.150 to 10.0.0.125 –
Thanks
Chris
You could use some Windows scripting. It gets a little messy but you could create the script in VB.Net, write it to your hard drive and then execute it. When done, you can delete the script.
Here is an example of a script that changes the IP Address (and some other related fields):
http://www.wincert.net/forum/topic/40-change-ip-configuration-via-vb-script/
Then, you would execute it in VB.Net by calling
Process.Start("<The path of your .vbs file here>")
Good luck.
Your IP Address is leased to you via your ISP when you go online - you can't just "change it". If your ISP uses Dynamic IP leasing, you can switch off your router/modem for around 5 minutes, and reconnect - at which point you'll receive a new IP.
The only way to replicate this via VB would be to disconnect the user from a modem-based service within your application. But in this case, I'd hazard a guess that clicking the "disconnect" button would be an easier solution for the user.
you may not need to write any script to do this. And you dont need 2 network adapters as the only way to do this. in windows the network adapter can be assigned several IP addresses at the same time. go into network properties ipv4 tcp/ip settings advanced. you can put several ip addresses and masks. so if you have one pc but are using 2 different networks, just put 2 addresses in, then whichever network is connected use it normally.
if you have a network gadget like a new router and its on 192.168.0.200 and you know its going to be set to 10.1.1.x after you login, assign the computer 2 IPs like 192.168.0.100 and then 10.1.1.100.