91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 8KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-27
  • 語言: C#
  • 標(biāo)簽: C#??Socket??

資源簡介

C# Socket 分包傳送數(shù)據(jù)是關(guān)于圖片傳送并且分割字節(jié)的一個(gè)資源。

資源截圖

代碼片段和文件信息

using?System;
using?System.IO;
using?System.ComponentModel;
using?System.Collections;
using?System.Diagnostics;
using?System.Net;
using?System.Net.Sockets;
using?System.Threading;
using?System.Windows.Forms;

namespace?NetClient
{
????/**////?
????///?TCPIPClient?提供在Net?TCP_IP?協(xié)議上基于消息的客戶端?
????///?

????public?class?TCPIPClient?:?System.ComponentModel.Component
????{
????????private?int?bufferSize=1024;
????????private?string?tcpIpServerIP=“127.0.0.1“;
????????private?int?tcpIpServerPort=11000;
????????private?Socket?ClientSocket=null;
????????private?ManualResetEvent?connectDone?=?new?ManualResetEvent(false);
????????private?IContainer?components;
????????private?ManualResetEvent?sendDone?=?new?ManualResetEvent(false);
????????
????????private?void?ConnectCallback(IAsyncResult?ar)?
????????{
????????????try?
????????????{
????????????????Socket?client?=?(Socket)?ar.AsyncState;
????????????????client.EndConnect(ar);
????????????????
????????????}?
????????????catch?(Exception?e)?
????????????{
????????????????onerrorEvent(new?ErrorEventArgs(e));
????????????}
????????????finally
????????????{
????????????????connectDone.Set();
????????????}
????????}
????????private?void?SendCallback(IAsyncResult?ar)?
????????{
????????????try?
????????????{
????????????????Socket?client?=?(Socket)?ar.AsyncState;
????????????????int?bytesSent?=?client.EndSend(ar);
????????????????//Console.WriteLine(bytesSent);
????????????}?
????????????catch?(Exception?e)?
????????????{
????????????????onerrorEvent(new?ErrorEventArgs(e));
????????????}
????????????finally
????????????{
????????????????sendDone.Set();
????????????}
????????}
????????private?void?ReceiveCallback(IAsyncResult?ar)?
????????{
????????????Socket?handler=null;
????????????try?
????????????{
????????????????lock(ar)
????????????????{
????????????????????Stateobject?state?=?(Stateobject)?ar.AsyncState;
????????????????????handler?=?state.workSocket;
????????????????????
????????????????????int?bytesRead?=?handler.EndReceive(ar);
????????????????????
????????????????????if?(bytesRead?>?0)?
????????????????????{
????????????????????????int?ReadPiont=0;????
????????????????????????while(ReadPiont????????????????????????{????
????????????????????????????if(state.Cortrol==0?&&?ReadPiont????????????????????????????{
????????????????????????????????long?bi1=state.buffer[ReadPiont];
????????????????????????????????bi1=(bi1<<24)&0xff000000;
????????????????????????????????state.packSize=bi1;
????????????????????????????????ReadPiont++;
????????????????????????????????state.Cortrol=1;
????????????????????????????}
????????????????????????
????????????????????????????if(state.Cortrol==1?&&?ReadPiont????????????????????????????{
????????????????????????????????long?bi1=state.buffer[ReadPiont];
????????????????????????????????bi1=(bi1<<16)&0x00ff0000;
????????????????????????

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件??????19788??2007-09-05?23:05??C#?Socket?分包傳送數(shù)據(jù)\ServerSocket.cs

?????文件???????5660??2009-11-26?18:08??C#?Socket?分包傳送數(shù)據(jù)\ClientSocket.resx

?????文件??????17015??2007-09-05?23:17??C#?Socket?分包傳送數(shù)據(jù)\ClientSocket.cs

?????目錄??????????0??2010-08-26?09:02??C#?Socket?分包傳送數(shù)據(jù)

-----------?---------??----------?-----??----

????????????????42463????????????????????4


評論

共有 條評論