I'm developing a real-time project about vehicle tracking with tcpip
socket and MVC. The socket inserted data from GPS to SQL Server, but when inserting a string of GPS, I have some process
For example, check over speed and out of range and ... if I want only insert string inside of the socket and write code of check, some data of GPS device string inside of SQL Server.
Can I write a trigger for that table when inserted record and pass some column of the row as a parameter to stored procedures for check data and process,...
If you have better Ideas about reducing process inside the socket, please guide me
Inside a trigger you have full access to the data inserted. So you can call a stored procedure from inside trigger and pass data to it. That's no problem. But you don't want to do this, because it slows down your socket process. Therefore you're asking for some other solution. I maybe would create an independent worker process that does the heavy calculation work.
But the most important suggestion here is - take a step back and architect your application correctly. From your question I see that you did not solve this part of your development process:
A socket
identifies an endpoint in a network.It is characterized by 4 "components":
-source ip
-source port
-destination ip
-destination port
When you open
a socket your os returns you a filedescriptor
(handle) for the file where the incoming data arrives.
Now coming back to your scenario i understood that you are receiving data via the tcp
protocol and you want to :
-insert said data into a `SQL Database`
-execute custom logic based on some triggers.
I sketched a simple diagram for what i believe is you want:
So your gps data would get directly inserted in your database on one hand.
Now regarding the triggers.Yould could do them directly from SQL
, or you could perform the checking in the server and then just call a stored procedure for the rest of your logic.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.