Say Wifi client (MAC ID : CLI) is connected to access point (MAC ID : AP). Client wants to send data to server (MAC ID : SER).
Then Client's Outgoing wifi packet has following MAC address fields.
To DS: 1
From DS: 0
Receiver address : MAC address of access point, which is AP (technicality it is called as BSSID)
Transmitter address : MAC address of client, which is CLI in this case
Destination address : MAC address of destination, which is SER in this case.
Client knows access point MAC ID while wifi connection establishment phase.
How does client fills server MAC? how client knows about server MAC?
First of all the CLI have the IP adresse of the server.
IF the two device are in the same network read this
CLI sends a broadcast request to all devices in the broadcast domain to get the mac address of the device having the configured IP adresse .
the SERVER responds to CLI by sending his own mac address .
The CLI fill destination MAC address and send to AP ,AP will redirect it to SERVER according ti Destination Mac addresse
to avoid this for every communication , CLI will save this mac adresse in the mac-address-table
IF the two devices CLI and SERVER are not in the same network you should learn about routing
Related
I use an ESP8266 in a Local Network. In my IOS App I need the IP Address of the ESP8266 for an HTTP Request. I Know that I can use a static IP but, the ESP8266 is a portable Projekt so maybe I use this in a different Local Network so I don't want to config the IP every time.
So the ESP8266 is connected to a Local Network. And my IPhone with my App is connected to the same network.
I've got the MAC Address and the Hostname of the ESP8266.
How can I get the local IP Address in Swift to do an Http request?
I am trying to connect to Mosquitto server installed locally by running the below script on Intel Edison board -
var client = mqtt.connect("ws://localhost:9001");
client.on('connect', () => {
console.log("connected");
})
But the connect event or the log is never called. Please note that when I try to call this from a webpage using -
var client = new Paho.MQTT.Client("localhost", 9001, "clientId");
client.connect(options);
This works.
The problem is connecting from the edison board. Did anyone face this issue?
As thrashed out in the comments,
The broker is not running on the Edison, so you can not use localhost as the host in the URL. localhost is the built in name for the loopback interface so always points to machine the code is running on.
You need to use the IP address of the machine (the laptop) where the broker is running.
If you are running all this in a environment with dynamic IP provisioning then you want to look at something called mDNS/Avahi which allows machines on the same subnet to be addressed by broadcast hostnames in the .local domain. That or move the broker to a machine with a static IP address and a DNS entry.
I have a localhost server on my laptop. Can I connect ios device to this localhost server through wifi?
What settings I must set up on wifi connection?
By localhost server , i assume you are talking about a HTTP server .
If you know the port on which the server is listening to , note it down.
If you dont , generally web servers are attached to port 80.
If both laptop and ios device is connected to the same network.
Then first note down the IPAddress of you laptop.
In windows you can do so by typing : ipconfig in the command prompt
In Unix or Linux based systems : type ifconfig in the terminal.
Lets assume you found out that your ipaddress is 192.168.1.2
Note down this IP Address of your wifi adapter.
Now , just type in IPAddress:Port in the web browser of your ios device to access the server.
eg: Type in 192.168.1.2:80 on the url bar of ios device.
I have a Mac OS X Server (10.8.3) that is in a DMZ. It has a domain name and an external and internal IP. When I am not on my network I can see the server when I open up Server.app on my client computer (for example when I have Wi-Fi on). But when I am logged into the network, I cannot see the server when I try to use Server.app, and nothing I enter allows me to connect to it.
Any help would be greatly appreciated.
Bryan
I have setup a local REST webservice with MAMP.
I have setup a virtual host with the url "http://aem.davidcasillas" pointing to my public folder.
MAMP is listening on port 80.
If I access via Safari to "http://aem.davidcasillas/webservice/rest/getEventosToday" I get the correct json data.
Now I'm trying to access this web service from my iPhone application. I run it from XCode into the device.
The device is connected to my local network via WIFI, and the connection is working (I can load webpages in safari)
I'm using RestKit to download the data and I'm trying to reach it with the same url I use in my Mac: "http://aem.davidcasillas.es/webservice/rest/getEventosToday".
In the device I get the error:
NSURLErrorDomain -1003 Found no server for the specified host name.
How should I write my url so I can reach the web service from the iPhone?
NOTE: I have read this post: test local websites with mamp on iphone? but none of this problems apply to my case. I have firewall disabled and my config.ini file shows the following listen line:
Listen 80
I have found a workaround.
I use the WIFI ip address in SystemPreferences->NetWork in my Mac and then the whole path to the resource, so instead of:
"http://aem.davidcasillas.es/webservice/rest/getEventosToday"
I am writing:
"http://192.168.1.6/aem.davidcasillas.es/public/webservice/rest/getEventosToday"
The 192.168.1.6part takes me to my local installation root folder /Applications/MAMP/htdocs/.
In the rest of the path I have to put the whole path to the resource. Notice that I have to include the public folder in the path. Hope I could use my virtual host setup, but have not found a way.
When I run hostname, it prints out
> hostname
ddopson.local
You can edit this in System Preferences ==> Sharing ==> Computer Name(text box at the top). Note that in the "computer name" textbox, I filled in "ddopson".
If you are on WiFi, you should be able to connect to that hostname (ddopson.local) from your iPhone. This works because both iOS and your Mac support Multicast DNS where a multi-cast UDP packet is emitted onto the L2 network to lookup local hostnames. When your Mac hears this multi-cast packet, it will reply to your iPhone with its ip-address and off you go.