Your question does not really outline the details of how you want to transmit the data, but if you want to go for a dead simple solution you could have a socket open on the server listening for incoming connections sending the data in any format you like.
So a desktop application looking something like:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Threading;
using System.IO;
using System.Net;
namespace Server {
class Program {
private Thread thread;
private Socket serverSocket;
private bool active;
public Program() {
IsActive = true;
serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
serverSocket.Bind(new IPEndPoint( IPAddress.Any, 4242));
serverSocket.Listen(4);
thread = new Thread(AcceptMethod);
thread.Start();
}
private void AcceptMethod() {
try {
while (IsActive) {
Console.Write("Waiting for client connection...");
Socket clientSocket = serverSocket.Accept();
Console.WriteLine("{0} connected!", clientSocket);
StringBuilder builder = new StringBuilder();
while (clientSocket.Connected && clientSocket.Available > 0) {
byte[] buffer = new byte[32];
int read = clientSocket.Receive(buffer);
builder.Append(Encoding.UTF8.GetString(buffer, 0, read));
}
Console.WriteLine("Read message: {0}", builder);
clientSocket.Close();
}
}
catch (Exception e) {
Console.WriteLine("Error: {0}", e.Message);
}
}
public bool IsActive {
get { return active; }
set {
active = value;
if (!IsActive)
{
serverSocket.Close();
}
}
}
static void Main(string[] args) {
Program program = new Program();
Console.ReadLine();
program.IsActive = false;
}
}
}
And a client application running on the device looking something like:
private void sendButton_Click(object sender, EventArgs e) {
string host = serverAddress.Text.Split(':')[0];
int port = Convert.ToInt32(serverAddress.Text.Split(':')[1]);
TcpClient client = new TcpClient(host, port);
byte[] buffer = Encoding.UTF8.GetBytes(String.Format("ClientId={0};Latitude={1};Longitude={2}", clientId.Text, latitude.Text, longitude.Text));
client.GetStream().Write(buffer, 0, buffer.Length);
client.Close();
}
Then, on the server side you could parse the message sent from the client to the server and store that in a file or in a DB or where ever you want.
Note that this is just an example to get you going, for an actual application you'd probably want to consider things like security as well, and more than likely use a http based approach instead.
As for showing it on a map, I'd look into the Google maps api or something similar.
Hope this helps,
Fredrik Bornander