使用TcpListener和tcpClient进行套接字编程

编程入门 行业动态 更新时间:2024-10-24 14:16:25
本文介绍了使用TcpListener和tcpClient进行套接字编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好, 顺应端口上可用的字节数. 当我们打电话给

Hello, supose there crore of byte avalable on a port. when we call

_client.Client.BeginReceive(_recieveBuffer, 0, 1024, SocketFlags.None, new AsyncCallback(OnBytesRecieved), null);

然后我们说

and after it we say

_client.Client.EndRecieve()

然后我们将一些字节存储在_recievBuffer中,可以了. 现在,如果下次再次调用

then we get some bytes stored in _recievBuffer its ok now if next time again calling

_client.Client.BeginReceive(_recieveBuffer, 0, 1024, SocketFlags.None, new AsyncCallback(OnBytesRecieved), null);

TcpClient.Endrecieve()

所以无论我们收到了什么,我都可以再次获得相同的数据吗??? 还是从头开始读取,并且在每个接收指针都移到下一个之后??

so here againt may i get same data whatever we have recieved????? or it stars reading from beginning and after each recieve pointer moved next??

推荐答案

我认为有关CodeProject的这篇文章可以为您提供帮助: 使用C#的TCP/IP聊天应用程序 [ ^ ] 这是一篇有关网络编程的文章. Hi, I think this article on CodeProject can help you: TCP/IP Chat Application Using C#[^] It''s an article about network programming.

更多推荐

使用TcpListener和tcpClient进行套接字编程

本文发布于:2023-11-06 21:34:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564729.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:TcpListener   tcpClient

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!