使用C#内置的Application Server Project,应用程序异常关闭 [英] Application Server Project built in C# , application shuts abnormally
问题描述
大家好,
我在用C#内置的Application Server Project中遇到问题.
此应用程序从TCP连接接收数据并创建文件.
同时,此文件正在被解释和进一步处理.
我正在使用TCPSERVER组件.它在多线程环境中工作.当任何客户端连接时,将分配一个单独的线程,并由该线程完成进一步的工作.
任何人都可以指导我,这将是什么问题,或者我的方法正确与否.
谢谢与问候
Rajesh
Hi to All,
I m facing a problem in an Application Server Project built in C#
This application receives data from TCP connection and make a file.
Meanwhile, this file is being interpreted and being processed further.
I am using TCPSERVER component. It works in a multi threaded environment. when any client conects, a separate thread is allocated and the further work is done by that thread.
Can anyone guide me , what would be the problem , or my approach is correct or not.
Thanks and Regards
Rajesh
推荐答案
如果这是一个要写入和读取的单个文件,则很可能会遇到线程同步问题,因为该文件可能在另一个文件中被写入线程正在尝试从中读取内容,反之亦然.查看 ReaderWriterLock [
If this is a single file that is being written to and read from you will most likely encounter thread synchronization issues since the file could be being written to while another thread is trying to read from it, or visa versa. Look in the ReaderWriterLock[^]
这篇关于使用C#内置的Application Server Project,应用程序异常关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!