C#字节流通过TCP [英] C# byte streams through TCP

查看:697
本文介绍了C#字节流通过TCP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名小工程师,希望能从这里的所有经验丰富的人那里寻求一些建议。



分配项目以创建通过TCP执行字节流传输的服务器/客户端应用程序。我们公司使用带有调度软件的GPS来处理双向无线电,我们想做一个服务器/客户端应用程序。目前,调度软件可以连接到用户必须是的中央基站,但是我们希望使这个软件可以从远程位置访问(如果基站是由距离调度器可以在的地方的中继器) )。

用户/客户端 - >麦克风的调查位置 - >服务器 - >基站 - > OTA信号 - >收音机并返回



我一直在寻找Windows Communication Foundation,但是我可以用其他方法处理这个问题吗?



我将主要使用C# / .NET / Visual Studio 2008

解决方案

我们使用UDP将GPS更新从汽车发送到处理更新的服务器。在这样的应用程序(你通常有有限的带宽),你可以真正地告诉UDP和瞬时TCP连接(如HTTP)之间的差异(从远程主机到服务器获取数据需要多长时间)。 UDP数据包将到达其目的地似乎是一个瞬间,并且TCP连接的设置是非常显着,通常需要几秒钟来完成。我喜欢WCF框架,但如果你的应用程序是我一直在使用的那种系统,我怀疑你会很高兴(...除非更新之间有一个很长的时间间隔)。



最近,我一直在使用持久TCP连接(使用原始Sockets),这是一个很好的方法,如果你想确保你的数据包到达目的地。虽然这样做的方式,我相信,是只要你可以连接打开,并结合代码重新连接,如果它打破。


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

解决方案

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.

这篇关于C#字节流通过TCP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆