cli/c++ using MAC address in raw socket - c++-cli

I want to use MAC address instead of IP address in RAW socket.
Is it possible?
Note: CLI/C++ and the system is connected to two devices

No, it is not possible.
So sorry

Related

Failed to use a computer to control two A6000 in the same time

I encounter a problem when I'm trying to use a Ubuntu laptop computer to connect to two Sony A6000 through WiFi in the same time.
On that laptop there are two WiFi adapters, one is embedded (say, Wifi-A) and the other is an Asus USB-N13 ProN USB
dongle (say, Wifi-B).
Using Sony Camera Remote API I can successfully control these two A6000 (say, A6000-A & A6000-B)
through these two Wifi adapters, provided only one camera is connected a time. For example, either using Wifi-A to control to
A6000-A or A6000-B, or using Wifi-B to control A6000-A or A6000-B, will work.
I think this proves both the cameras and Wifi adapters hardware function correctly, and any combination of Wifi adapter and
camera works fine, too.
However, it will be different if I try to connect and control both cameras in the same time. The connection to both cameras
is OK (though sometimes not very smooth), but controlling them is not.
Here is a list of the experiment steps:
Wifi-B connects to A6000-B. Then Wifi-B gets IP address 192.168.122.166
Wifi-A connects to A6000-A. Then Wifi-A gets IP address 192.168.122.165
Send M-SEARCH request to Wifi-A and get response from A6000-A. Then get
Device Description XML file from A6000-A successfully.
Send M-SEARCH request to Wifi-B and never get response
I'm wondering if such configuration (One laptop + two Wifi adapter + two A6000) violates any design consideration
of A6000? For example, because both cameras use the same IP address 192.168.122.1 for themselves?
I'll appreciate if any one could comment on this issue.
Thanks in advance!
Xavier
After doing experiments for many days, I'm sure this symptom is caused by the IP address conflict (both of them are 192.168.122.1) of these two A6000.
As I can't find a way to change them, my optimal solution under such configuration (one laptop + two Wifi adapter + two A6000) is to make use of Linux Network Namespaces. Moving Wifi-B to a new Network Namespace does solve this issue, because every Network Namespace has its own network stack. Now I can freely access both of these A6000 from my laptop.
I hope this answer is helpful to anyone who encounters a similar problem.
There isn't any design consideration that would block this from working. Unfortunately we cannot offer any other troubleshooting suggestions.

Communication With Siemens S7300 PLC through PC Ethernet Port

I have got a Siemens PLC (S7 315-2 PN/DP PLC), which has got a built in Ethernet port.
I want to establish communication between PLC and my PC through TCP/IP (VB.NET based program).
How can it be done ? is any demo or example program available for this ?
Try also Snap7, 32/64 bit with .NET/mono wrappers ready
Libnodave has examples for many languages and VB.NET is one of them. I have used it a lot my self with Pascal and C.
If you want to send data based on events you could also use the 315's build-in Ethernet cummunication blocks and send a data packet (like emulated XML or JSON) each time something interresting happens. I did it a few times and it works very well.

Send string to another computer

I have a string that I want to send to another computer that uses my software. I would like to send the string directly to the software in the other computer. Is there any way to do it?
other alternatives are to use tcp or udp broadcasts
If you need to send the string to multiple computers at once you can use a udp broadcast to 255.255.255.255 ; however with udp there is no confirmation of receipt.
Lots of examples are available if you search for them, here is one:
http://msdn.microsoft.com/en-us/library/tst0kwb1(v=VS.71).aspx
A standard way of achieving such task is to use Sockets. There are plenty of examples over the internet depending on the language and environment you are using.
The following link might be useful to you:
http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.aspx

Mac app UDP data over its own IP

Is it possible for an objective-c mac app to send UDP data to its own IP address?
If so, can someone show me an example? code?
Thanks!
Have a look at http://code.google.com/p/polkit containing Objective-C UDPSocket sample code and MiniUDPSocket to send and receive network data over UDP:
polkit-read-only/Apple-Networking/UDPSocket.h
polkit-read-only/Apple-Networking/UDPSocket.m
polkit-read-only/Networking/MiniUDPSocket.h
polkit-read-only/Networking/MiniUDPSocket.m

How to get ip address for the local system

Hi friends. I am developing an application in which I am returning the IP address for a particular system and saving it in a database. When I check the database it is showing the server ip address. I want get the particular ip address who is running that application.
So far I have this code:
Public Function GetIPAddress() As String
Dim strHostName As String = System.Net.Dns.GetHostName()
Dim strHostName1 As String = System.Net.Dns.GetHostName()
Dim ipHostInfo As System.Net.IPHostEntry = System.Net.Dns.Resolve(System.Net.Dns.GetHostName())
Dim ipAddress As System.Net.IPAddress = ipHostInfo.AddressList(0)
Return ipAddress.ToString()
End Function
Keep in mind that a machine may have multiple IP addresses pointing to it, so this isn't really possible. Well, not in theory anyway - in practice, you may be able to hack something together.
That's undoubtedly because your code is running on the server itself, not the client. Hence, when you ask for the IP address, it faithfully gives it to you.
Any solution running on the server (such as examining the source IP address of the TCP session) has to keep in mind that, with firewalls and network address translation and all the other wonderful features of networking that protect us from the baddies, the address you get may bear little resemblance to the actual IP address of the client machine.
You need to get code running on the client machine that can basically do the same thing. And keep in mind there that a client may have many IP addresses allocated to it.
On my desktop machine alone, I have two physical NICs, each with two addresses and multiple virtual NICs for VPNs and VMWare images. Granted, my desktop box is not your ordinary home PC, but it's not out of the realms of possibility for a box to have two addresses.
And, in fact, a single machine can quite easily change its IP address if on DHCP and it decides to release the lease on its address and get another one.
All in all, the IP address is not a very reliable indicator of which machine is doing things. Perhaps if you step back and give us more details on what you're trying to achieve, we can help further.
Use the code below to get the ip of the client system.
string host=System.Net.Dns.GetHostName();
string ip = System.Net.Dns.GetHostByName(host).AddressList[0].ToString();
Here the ip address give the client ip address.
Perhaps this would help? - https://stackoverflow.com/a/23824592/2647808
It looks like the best way to do it is with System.Net.Dns.GetHostName(). You can then extract either the IPv4 address or IPv6 address with a For loop and If statement. Hope that helps.