GPS and GSM interface for remote TCp server

Awesome.... Thanks for the update.

Here is the new set of code: The only task I want to perform is to send the SMS to my number 9007558976:

#include <SoftwareSerial.h>
#include "TinyGPS.h"
#define RXPIN 3
#define TXPIN 4

SoftwareSerial gpsSerial(TXPIN , RXPIN);  //4 is for TX and 3 is for RX
TinyGPS gps; // create gps object
const int timesTosend=1;
char phone_no[]="9007558976";

void setup() {
  Serial.begin(115200);
  gpsSerial.begin(9600); // connect gps sensor
  delay(2000);
  Serial.println("AT+CMGF=1");
  delay(200);
 
}

void loop() {
  static int count = 0;
  static long lat=0,lon=0;

  if (count < timesTosend)
  {
    while(gpsSerial.available()) 
{
      char c = gpsSerial.read();
      
      Serial.print(c); 
      if(gps.encode(c)) { // encode gps data
        gps.get_position(&lat,&lon); // get latitude and longitude
        Serial.print("AT+CMGS=\"");
        Serial.print(phone_no);
        Serial.println("\"");

        // Wait for '>'
        while(Serial.read() != '>');
        Serial.print(lat);
        Serial.print(", ");
        Serial.print(lon);
        Serial.write(0x0D);  // Carriage Return in Hex
        Serial.write(0x0A);  // Line feed in Hex
        Serial.write(0x1A);  // sends ctrl+z end of message

        count++;

        //The 0D0A pair of characters is the signal for the end of a line and beginning of another.
        delay(5000);
      
      }
    }
  }
}

While compiling I am facing the below error :

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x24
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x47
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x50
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x52
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x4d
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x43
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x2c
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x2c
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x56
An error occurred while uploading the sketch
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x2c

Please advice ..

Thanks-
Pokhraj