SIM900A module - sending data to server (gsmlib.org library)

I’m using sim900a module + arduino uno + gsmlib.org library

My problem: I sent a string to my server, and it worked correctly for the first time when i using “inet.httpPOST” function in void setup(). And in void loop(), when i call that function again, it doesn’t work. I just had a notification in serial moniter “ALREADY CONNECT”

How can i send data to my server continously in void loop()

I hope you can help me. Thank you !

I got an example from: http://www.open-electronics.org/the-gsmgprs-gps-shield-some-http-connections-examples/

My example code:

#include "SIM900.h"
 
#include <SoftwareSerial.h>
 
#include "inetGSM.h"
 
InetGSM inet;
 
int k=0;
 
int j=0;
 
char msg[150];
 
boolean found=false;
 
char data;
 
int numdata;
 
//char inSerial[50];
 
int i=0;
 
boolean started=false;
 
void setup()
 
{
 
Serial.begin(9600);
 
Serial.println("GSM Shield testing.");
 
if (gsm.begin(2400)){
 
  Serial.println("\nstatus=READY");
 
  started=true;  
 
}
 
else Serial.println("\nstatus=IDLE");
 
if(started){
 
  if (inet.attachGPRS("internet.wind", "", ""))
 
    Serial.println("status=ATTACHED");
 
  else Serial.println("status=ERROR");
 
  delay(1000);
 
  numdata=inet.httpPOST("MY ID ADDRESS", PORT, "", "my string i'm using to send to server",msg, 50);
//It work
}
 
};
 
void loop()
 
{
 numdata=inet.httpPOST("MY ID ADDRESS", PORT, "", "my string i'm using to send to server",msg, 50);
//It doesn't work when i use it again

 
}
 
}

moderator: double post removed + changed quote tags -> code tags

I want to send sms to phone from arduino . but i can not send sms from arduino but i can receive sms from phone . I have used SIM900A mini v3.8.2 module .

The code i used is bellow :
#include <SoftwareSerial.h>
SoftwareSerial GPRS(7, 8); // RX, TX

void setup()
{
pinMode(10,OUTPUT);
GPRS.begin(9600);
Serial.begin(9600);
delay(100);
}

void loop()
{

if(Serial.available()>0)
switch(Serial.read())
{
case ‘t’:
SendTextMessage();
break;
case ‘r’:
RecieveTextMessage();
break;

}
if (GPRS.available()>0)
Serial.write(GPRS.read());
}
void SendTextMessage()
{

GPRS.println(“AT+CMGF=1”); //Because we want to send the SMS in text mode
delay(100);
GPRS.println(“AT+CMGS=”+8801773340092"\r"); // change to the phone number you using
delay(100);
GPRS.println(“A test message!”);//the content of the message
delay(100);

GPRS.println((char)26);//the ASCII code of the ctrl+z is 26
delay(100);
}
void RecieveTextMessage()
{
digitalWrite(10,HIGH);
GPRS.println(“AT+CMGF=1\r”);
delay(200);

//mySerial.println(“AT+CNMI=2,2,0,0,0”);
//delay(200);

//mySerial.println(“AT+CSCS=“GSM”\r”);
//delay(100);

// GPRS.println(“AT+CMGL=“ALL”\r”); // to read ALL the SMS in text mode
// delay(200);
GPRS.println(“AT+CMGR=3\r”);// to read the SMS in text mode from location x
//delay(100);
}