R
Ron Skufca
I am implementing a UDP server to retrieve and process GPS coordinates from a
client application installed in various vehicles. Right now there are around
10 UDP clients sending data with that figure expected to grow to hundreds in
the future. The basic architecture is as follows:
1.) Client sends UDP position message (around 100 ASCII chars) about 1 per
sec to a predefined port.
2.) UDP server is listening on predefined port with the Socket.ReceiveFrom
method.
3.) When UDP server receives message it fires an event to process the message.
Part 1, 2 and 3 are implemented and seem to be working fine in a test
environment. My question is the best way to handle the following.
3.) Parse the message and create a valid SQL Insert or update statement to
insert into an SQL Server 2005 database.
My initial thought was to spawn a thread to handle the parsing/inserting of
the incoming messages, but with messages streaming in continusously I don't
think this would be the best way.
My other idea which i don't have much experience with is to create a queue
and stick each incoming message in the queue and have another thread handle
retrieving the messages from the queue and doing the SQL insert/update.
What would be the pros and cons of using the queue?
Also are there any other patters that might be helpful in this situation
that I can research.
Thanks,
Ron
client application installed in various vehicles. Right now there are around
10 UDP clients sending data with that figure expected to grow to hundreds in
the future. The basic architecture is as follows:
1.) Client sends UDP position message (around 100 ASCII chars) about 1 per
sec to a predefined port.
2.) UDP server is listening on predefined port with the Socket.ReceiveFrom
method.
3.) When UDP server receives message it fires an event to process the message.
Part 1, 2 and 3 are implemented and seem to be working fine in a test
environment. My question is the best way to handle the following.
3.) Parse the message and create a valid SQL Insert or update statement to
insert into an SQL Server 2005 database.
My initial thought was to spawn a thread to handle the parsing/inserting of
the incoming messages, but with messages streaming in continusously I don't
think this would be the best way.
My other idea which i don't have much experience with is to create a queue
and stick each incoming message in the queue and have another thread handle
retrieving the messages from the queue and doing the SQL insert/update.
What would be the pros and cons of using the queue?
Also are there any other patters that might be helpful in this situation
that I can research.
Thanks,
Ron