Click here to Skip to main content
11,928,605 members (56,509 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Windows .NET Sockets
Hello every one,

I am working on a GPS vehicle tracking project . Here the device used to send Latitude and Longitude signals to a particular IP (Static IP) in 5000 port there are totally 17 devices.So my problem is when all the 17 device are activated I am not getting the readings form all device in a proper time duration.
Means if I got the readings of Device 1 i will continuously get 5 to 6 readings form that device after that when Device 2 i will continuously get 5 to 6 readings similarly it goes on . What I am going to say here is all the device transmit the readings (Latitude,Longitude) for every 1 mint to my IP but when i get the Signal form device I will get only form device 1 after few 5 to 6 mints Device 2 then 3 . So my problem is my application is loosing the packets . means when my application is receiving data from Device 17 . Application is receiving the last 5 to 6 mints readings but it has lost the readings from past 10 to 30 mints. So how can I get the signal from all the devices parallely to same port using one socket .

Here is the code how I Implemented.

 Thread th_main,th_sub;
bool bool_Start_subTH;
 Socket Socket_Client ;
TcpListener objListener;

private void Form1_Load(object sender, EventArgs e)
            th_main = new Thread(GetDataFromClient);
void GetDataFromClient()
objListener = new TcpListener(5000);
    while (th_main.IsAlive)
 Socket_Client= objListener.AcceptSocket();
  th_sub=new Thread (SubFunctionThread);
void SubFunctionThread()
                    byte[] something = new byte[Socket_Client.Available];
                    string strmessage = Encoding.ASCII.GetString(something);
                    Listbox1.Items.Add( strmessage);               


Here is my code . Is it right if not then suggest me how can I solve my problem .If any example is there means it will be very helpful for me

Thanks in Advance.
Posted 23-Jun-13 23:44pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 24 Jun 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100