get message form tcp server

Hi, i use SIM900 libary and i want get message from TPC arduino server

so… i juse this command with PHP

echo socket_read($socket,100);

so… how i can get message from server?

Hi, i use SIM900 libary and i want get message from TPC arduino server

All the words are spelled correctly, but the semantic content is still NULL.

What does TPC mean? Where is your code?

If the SIM900 library is used with the SIM900 chip on a shield on the Arduino which is acting as a server, it isn't clear why you are having a problem getting a message.

so.. i juse this command with PHP

Is PHP really running on your Arduino? If so, can you post a reply detailing exactly how you got the PHP engine to run on the Arduino, and which Arduino you managed that for?

arduino code:

#include "SIM900.h"
#include "SoftwareSerial.h"
#include "inetGSM.h";

float tempC = 0, dregn = 0;
int numdata, led = 13, state, flag = 0;
InetGSM inet;

void setup() 
{
  pinMode(led, OUTPUT);
 
  Serial.begin(9600);
  Serial.println("GSM Shield ArduiCar");

 
  if (gsm.begin(9600)){
    Serial.println("Software Serial begin at 9600");
    gsm.forceON();
  }  
    
    gsm.SimpleWriteln("AT+CIPMODE=1");
    delay(2000);
    if (inet.attachGPRS("internet.tele2.lt", "", "")){
      Serial.println("APN Settings ok! Starting GPRS Connection!");
      gsm.SimpleWriteln("AT+CIFSR");
      delay(5000);
      gsm.WhileSimpleRead();
      inet.connectTCPServer(5000);
      delay(5000);
      Serial.println("\nTCP Server waiting at port: 5000");
      Serial.println("\n"); }
}

void loop() {
  state = gsm.read();
  if (state == 'o'){
    digitalWrite(led, HIGH);
    Serial.println("ON");
  }else if (state == 'f'){
    digitalWrite(led, LOW); 
    Serial.println("OFF");
  }
}

float temp(){
  delay(500);
  tempC = analogRead(5);
  delay(500);
  tempC = (5.0 * tempC * 100.0) / 1024.0;
  return tempC;
}

float dreg(){
  delay(500);
  dregn = analogRead(4);
  //dregn = dregn / 1023 * 100;
  delay(500);
  return dregn;
}

and PHP

$service_port = '5000';
$address = '90.142.176.220';
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$result = socket_connect($socket, $address, $service_port);
socket_write($socket, 'o');
echo socket_read($socket,100);
      gsm.WhileSimpleRead();

What does this do? It implies that it reads something, which implies that it should return (or at least output somehow) what it read. If it returns something, why don't you print it?

What does the code actually do? What do you expect it to do?

if (state == 'o'){
    digitalWrite(led, HIGH);
    Serial.println("ON");
 }

when i say q i want return "OK!";

but if i use this:

numdata=inet.httpGET("www.klondaikas.lt", 80, "/arduino/newIp.php", msg, 50);

not working this:

gsm.WhileSimpleRead("OK!");

i need use this

numdata=inet.httpGET("www.klondaikas.lt", 80, "/arduino/newIp.php", msg, 50);

because i have dynamic IP adress and i save IP adres in newIp.php but this

gsm.WhileSimpleRead("OK!");

not woking