source mac address from socket

53 views
Skip to first unread message

Peter Petra

unread,
Nov 20, 2014, 5:05:11 AM11/20/14
to rf22-a...@googlegroups.com
Hi,
I have program for receive sockets but i don´t know how can i get source mac address from sockets.
Here is my sketch: 
#include <SPI.h>         // needed for Ethernet library communication with the W5100 
#include <Ethernet.h>
#include <utility/w5100.h>
#include <EtherRaw.h> 
SOCKET s; // our socket that will be opened in RAW mode
byte rbuf[1500+14]; // buffer to send through socket
int rbuflen; // length of data to send
void setup() {
  Serial.begin(9600);
   // initialize the w5100 chip and open a RAW socket  
  W5100.init();
  W5100.writeSnMR(s, SnMR::MACRAW); 
  W5100.execCmdSn(s, Sock_OPEN);
}
void loop() {
  rbuflen = W5100.getRXReceivedSize(s);
   if (rbuflen>0) {
    // receive socket
    Serial.println("receive socket");
    W5100.recv_data_processing(s, rbuf, rbuflen);
    W5100.execCmdSn(s, Sock_RECV);
  }
  delay(1000);
}

Mike McCauley

unread,
Nov 20, 2014, 6:51:15 AM11/20/14
to rf22-a...@googlegroups.com
On Thursday, November 20, 2014 02:05:10 AM Peter Petra wrote:
> Hi,
> I have program for receive sockets but i don´t know how can i get source
> mac address from sockets.

Im sorry to hear that.
Maybe you should consult a forum where there are people that might help you
with that.

Cheers.


> Here is my sketch:
>
> #include <SPI.h> // needed for Ethernet library communication with
> the W5100
> #include <Ethernet.h>
> #include <utility/w5100.h>
>
> #include <EtherRaw.h>
>
> SOCKET s; // our socket that will be opened in RAW mode
> byte rbuf[1500+14]; // buffer to send through socket
> int rbuflen; // length of data to send
> void setup() {
> Serial.begin(9600);
> // initialize the w5100 chip and open a RAW socket
> W5100.init();
> W5100.writeSnMR(s, SnMR::MACRAW);
> W5100.execCmdSn(s, Sock_OPEN);
> }
> void loop() {
> rbuflen = W5100.getRXReceivedSize(s);
> if (rbuflen>0) {
> // receive socket
> Serial.println("receive socket");
> W5100.recv_data_processing(s, rbuf, rbuflen);
> W5100.execCmdSn(s, Sock_RECV);
> }
> delay(1000);
> }

--
Mike McCauley VK4AMM mi...@airspayce.com
Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia
http://www.airspayce.com
Phone +61 7 5598-7474

Reply all
Reply to author
Forward
0 new messages