4956

C# byte streams through TCP

Question:

I'm a Jr. Engineer hoping to seek some advice from all of the experienced people in here in regards to how to approach this.

I've been assigned a project to create a server/client application that does byte streaming through TCP. Our company deals with 2-way radios with GPS with a dispatch software and we would like to make a server/client application out of that. Currently the dispatch software can be hooked up to a central base station where a user has to be, but we want to make this software accessible from a remote location (if the base station is by a repeater miles away from where a dispatcher can be at).

User/Client -> poll location of a mic -> server -> base station -> OTA signal -> radio and back

I've been looking at Windows Communication Foundation, but what are other ways I can approach this?

I'll be primarily using C# / .NET / Visual Studio 2008

Answer1:

We have used UDP to send GPS updates from cars to a server that processes the updates. In applications like that (where you often have limited bandwidth) you can really tell the difference (in terms of how long it takes to get the data from the remote host to the server) between UDP and momentary TCP connections (like HTTP). A UDP packet will get to its destination in what seems like an instant, and the setup for the TCP connection is very conspicuous, often taking several seconds to complete. I like the WCF framework, but if your app is the sort of system I've been working with, I doubt you'll be happy with it (...unless it's OK to have a long interval between updates).

Lately, I've been working with persistent TCP connections (using raw Sockets), which is a good way to go if you want to make sure your packets arrive at their destination. Though the way to do that, I believe, is to leave the connection open as long as you can and incorporate code to reconnect it if it breaks.

Answer2:

If you just want a raw byte stream, then a <a href="http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.aspx" rel="nofollow">Socket</a> or the slightly more encapsulated <a href="http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx" rel="nofollow">TcpClient</a> might be a more light weight solution.

But if you want to send complete data structures and "call functions" then WCF seems like a good choice.

With WCF you have a programming experience close to calling regular methods with real objects as parameters, but with a Socket you just send byte arrays and need to interpret the result all by your self.

Recommend

  • Getting ActiveX component cant create object while trying to connect to ALM through VB macro
  • How to change Repeater DataSourceID?
  • asp:HyperLink build NavigateUrl within Repeater using XPATH data
  • Connecting 2 dropDownLists with SqlDataSource FilterExpression inside ASP:Repeater
  • How to describe element attributes with Spyne
  • How to show picture that is stored in SQL Server database using ASP.NET?
  • Using Protractor with Angular2
  • android mediarecorder error (MediaRecorder start failed : -19)
  • how to check the checkbox inside the repeater at binding time accordingto value?
  • Can I place a asp:datalist inside a repeater control and databind it?
  • How to make GridView multicolumn in Asp.Net
  • How to make a linkbutton onclick with parameters
  • Calculating the distance between ZIP Codes in R with the mapdist function
  • What is the parameter “distance” when using search fql?
  • AVCaptureDevice returning nil
  • Textbox value not getting cleared
  • Get Repeater data with foreach
  • Polymer - dom-repeat & caching of element data in DOM tree
  • Autocomplete with jQuery and asp.net repeater fills ID
  • How to change sample rate properly in Avfoundation
  • Consuming Sabre soap services using .net
  • Is Android capable of managing microphone/input volume?
  • Parallel Computing - Shuffle
  • Passing uniform webservices through Camel
  • Django AJAX requests during regular request not going through
  • How to Compose OSGi Based project with C++ based project?
  • How to send control C to Mac Terminal using python?
  • triggering user space with kernel
  • Recording values of radio buttons in ember
  • Flash radiobutton: how do I get the selected radiobutton?
  • Dart - Isolate Cross Window Communication
  • How do I display a dialog that asks the user multi-choice questıon using tkInter?
  • Intel-64 and ia32 atomic operations acquire-release semantics and GCC 5+
  • Force show.bind execution
  • C# - Serializing and deserializing static member
  • Sony Xperia Z Tablet not found by adb
  • Where to put my custom functions in Wordpress?
  • Javascript convert timezone issue
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • How do you join a server to an Active Directory (domain)?