通过异步套接字连接和断开连接 [英] sending over asynchronous socket connect and disconnect

查看:83
本文介绍了通过异步套接字连接和断开连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


有人可以帮助我吗?我正在开发一个客户端sockect来将事务从DB发送到服务器套接字。我想要的方式是连接,发送,接收,断开连接,连接,发送,接收和断开......就像那样,直到所有交易上传。我的问题是当我发送时,我正在关闭套接字,当我尝试连接并再次发送时,我收到以下错误一旦套接字断开连接,您只能再次异步重新连接,并且只能重新连接到另一个端点。必须在一个线程上调用BeginConnect,该线程在操作完成之前不会退出。

Hi all,

can anybody help me out there? I am developing a client sockect to send transactions form a DB to a server socket. the way i want is to connect, send, recieve , disconnect, connect, send, recieve and disconnect.... like that until all the transactions are uploaded. my problem is when i send, I am shutting down the socket and when i try to connect and send again i get the following error "Once the socket has been disconnected, you can only reconnect again asynchronously, and only to a different EndPoint. BeginConnect must be called on a thread that won''t exit until the operation has been completed."

推荐答案

您使用的是UDP,为什么使用BeginConnect和所有这些业务?
Are you using UDP, why are you using BeginConnect and all that business?



大家好,


有人可以帮助我吗?我正在开发一个客户端sockect来将事务从DB发送到服务器套接字。我想要的方式是连接,发送,接收,断开连接,连接,发送,接收和断开......就像那样,直到所有交易上传。我的问题是当我发送时,我正在关闭套接字,当我尝试连接并再次发送时,我收到以下错误一旦套接字断开连接,您只能再次异步重新连接,并且只能重新连接到另一个端点。必须在一个线程上调用BeginConnect,该线程在操作完成之前不会退出。
Hi all,

can anybody help me out there? I am developing a client sockect to send transactions form a DB to a server socket. the way i want is to connect, send, recieve , disconnect, connect, send, recieve and disconnect.... like that until all the transactions are uploaded. my problem is when i send, I am shutting down the socket and when i try to connect and send again i get the following error "Once the socket has been disconnected, you can only reconnect again asynchronously, and only to a different EndPoint. BeginConnect must be called on a thread that won''t exit until the operation has been completed."




任何人请帮助我。我被困了



anybody please help me. i am stuck


除了使用beginconnect之外还有其他方法吗?请帮助
is there any other way around it besides using beginconnect? please help


这篇关于通过异步套接字连接和断开连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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