Jump to content
  • Announcements

    • EmperoR

      Dear Guests   12/24/2016

      Welcome to the GIS-AREA. like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be a part of GIS-AREA by signing in or creating an account here. Once you have created your account and have introduced yourself to our community, you can start new topics, reply to others, subscribe interesting threads, get your customize profiles, make news friends, and others nice stuff. To make your stay as pleasant and constructive as possible, please don't forget to read through our pinned forum rules and board guidelines in each section before you do anything else.
Sign in to follow this  

Socket Programming issue for GPS Tracking Devices

2 posts in this topic Last Reply

Recommended Posts

Dear Friends,


Me and my colleagues are trying to make an application for routing purposes. This application has to be in a mutual transaction with a GPS tracking device obviously. Here come the issues we encounter


1. We are getting the login data but after that we need to send response to device with a format that device can verify server and then send actual GPS data to server.

2. We are not able to send login data to that device so that's why device not send us GPS data.

3. Login Data we are getting is like :- 2323101501f357367031649441529625060.

4. We are not getting further process what to do to get Device GPS data to our server.


We have asked for the GPS device support, no useful information but offering their own portal.


and here is the code developed for this transaction :

package com.trackit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ServerListener {

    public static void main(String[] args) {
        new ServerListener().startServer();

    public void startServer() {
        final ExecutorService clientProcessingPool = Executors.newFixedThreadPool(03);

        Runnable serverTask = new Runnable() {
            public void run() {
                try {
                    ServerSocket serverSocket = new ServerSocket(5094);
                    System.out.println("Waiting for clients to connect...");
                    while (true) {
                        Socket clientSocket = serverSocket.accept();
                        clientProcessingPool.submit(new ClientTask(clientSocket));
                } catch (IOException e) {
                    System.err.println("Unable to process client request");
        Thread serverThread = new Thread(serverTask);

    private class ClientTask implements Runnable {
        private final Socket clientSocket;

        private ClientTask(Socket clientSocket) {
            this.clientSocket = clientSocket;

        public void run() {
            System.out.println("Got a client !");
            try {
                BufferedReader reader = new BufferedReader( new InputStreamReader(clientSocket.getInputStream()));
                String clientData = "";
                clientData = reader.readLine();
                String hex_value = asciiToHex(clientData);
                System.out.println("Hex Value :-"+hex_value);
            } catch (IOException e) {
		private String asciiToHex(String clientData) {
			char[] chars = clientData.toCharArray();
		    StringBuffer hex = new StringBuffer();
		    for (int i = 0; i < chars.length; i++)
		    return hex.toString();


Any kind of tips and help is appreciated.

Kindly Regards

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

By using this site, you agree to our Terms of Use.