Go Down

Topic: Problem while using wireshark to see the arduino packet (Read 325 times) previous topic - next topic

fire1

hello ,

I want to connect my pc with the arduino , I have used OpenDhcpServer to assign IP to the arduino , but I'm having a problem somewhere , I think it's in the code , and I think specific in this line :
client.println("GET /HIGH HTTP/1.0");
I'm not familiar with network , that's why I need to figure it out .

the project I want to use it to connect it with other device , the device should recieve a specific message , I used wireshark to read the message but it gives 00 in the last place of the code , So I need to know what is my problem how can I read the packet to take an action on it .

Code: [Select]
#include <SPI.h>
#include<Ethernet.h>

byte mac[] = {0x54, 0x04, 0xA6, 0x55, 0xF7, 0x88}; //physical mac address
IPAddress server(192,168,0,4);//Server1
EthernetClient client; //Client

void setup(){
  Serial.begin(9600);
  pinMode(2,INPUT);
  pinMode(4,OUTPUT);
  pinMode(6,OUTPUT);
  Ethernet.begin(mac);
}
void loop(){
  // start the Ethernet connection:
  Serial.println("connecting");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for(;;);
  }
  Serial.println("connecting");
  if(digitalRead(2)==HIGH){
    Serial.println("The state is high");
    if (client.connect(server,84)){
      Serial.println("connected");
      digitalWrite(6,HIGH);
      client.println("GET /HIGH HTTP/1.0");
  }}
    else{
      Serial.println("The state is low");
      if (client.connect(server,84)){
      Serial.println("connected");
      digitalWrite(6,LOW);
      client.println("GET /LOW HTTP/1.0");
  }
    }
}
   

PaulS

What web server software are you running on the PC (192,168,0,4)? You need to be running something that is listening to http requests, and that something needs to know to listed to port 84, too.

In that something's root directory, you need to have scripts/executables, named HIGH and LOW. Do you? What do HIGH and LOW do?

That something should be creating logs that show every attempt to connect to the server, valid or not. What are those logs showing you?

fire1

thanks for the reply ,

My friend I don't want to create scripts/executable , I just want the message the to appear while I'm sending this message the other device should have to detect a specific message throw the web and then do his action after that , I have opened already the TCP frame in the wireshark and still there is no data into it , why ?
what is my exact problem ?
how can I solve it ?
other thing while I opened the serial monitor to see how it's worked I saw the device working slowly what is the problem exactly , thanks .


SurferTim

You failed to answer one question. Is your server listening on port 84? Most web servers listen on port 80 and will refuse a connection on any other port.

And call the Ethernet.begin(mac) function in the setup(), not the loop().


PaulS

Quote
My friend I don't want to create scripts/executable

You'll need to get over that, eventually.

Quote
I just want the message the to appear while I'm sending this message

Appear where? What wireshark is looking at is data that the httpd daemon is getting. No httpd == no wireshark data.

Quote
the other device should have to detect a specific message throw the web

What other device? How is it connected? What software is it running?

Quote
I have opened already the TCP frame in the wireshark and still there is no data into it , why ?

Because there is no http daemon running to generate the data? I don't know. You didn't answer all of my questions.

Quote
what is my exact problem ?

Because not being able to answer all the questions? I don't know, without answers to the questions I asked.

Quote
how can I solve it ?

The first step is to admit that you have a problem. OK, you've done that.
The second step is to define exactly what the problem is. You seem clueless there.

Quote
other thing while I opened the serial monitor to see how it's worked I saw the device working slowly what is the problem exactly

The Arduino is working, and that is a problem? How?

Go Up