asp.net中应用Socket传递接收数据

ContractedBlock.gif ExpandedBlockStart.gif Socket获取传递参数后的返回值
None.gif            string StartTime = IROperatieDB.StringWipeOffEmpty(Meeting_Start);
ExpandedBlockStart.gifContractedBlock.gif            
string[] MeetingIP = ConfigurationSettings.AppSettings["Operationculti"].ToString().Split(new char[] dot.gif{'/'});
None.gif            
string strMeetingParameter = "/meeting?command=StartMeeting&mainSubject="+MeetingTitles+"&meetingID="+MeetingRoomID+";
None.gif
            System.Text.Encoding Acs = System.Text.Encoding.ASCII;
None.gif            
string MeetingUrl = "GET "+strMeetingParameter+" HTTP/1.0\r\nAccept: */*\r\nHOST: " + "localhost" + "\r\nConnection: Close\r\n\r\n";
None.gif            
//string MeetingUrl = "GET /meetingAdmin?command=StartMeeting&mainSubject="+MeetingTitles+"&meetingID="+MeetingRoomID+"&startTime=2006-5-10:0:00&auditorPassword=&roomDir=/roomWeb&meetingType=0&totalBandwidth=-1&maxUserNum=400&recordRight=0 HTTP/1.0\r\nAccept: */*\r\nHOST: " + "localhost" + "\r\nConnection: Close\r\n\r\n";
None.gif            
//    string Get = "GET / HTTP/1.0\r\nAccept: */*\r\nHOST: " + "localhost" + "\r\nConnection: Close\r\n";
None.gif
            byte[] urles = Acs.GetBytes(MeetingUrl);
None.gif            Socket s 
= new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
None.gif            IPAddress ipAddress 
= IPAddress.Parse(MeetingIP[MeetingIP.Length -1].ToString());
None.gif            IPEndPoint ipLocalEndPoint 
= new IPEndPoint(ipAddress,80);
None.gif            s.Connect(ipLocalEndPoint);
None.gif            s.Send(urles,
0,urles.Length,SocketFlags.None);
None.gif            
byte[] bytes = new byte[2048];
None.gif            
//s.Receive(bytes,0,s.Available,SocketFlags.None);
None.gif
            
None.gif            
try
ExpandedBlockStart.gifContractedBlock.gif            
dot.gif{
InBlock.gif                s.Receive(bytes);
InBlock.gif                
string MeetingState = Acs.GetString(bytes,0,bytes.Length);
ExpandedSubBlockStart.gifContractedSubBlock.gif                
string[] MeetingStateTeam = MeetingState.Split(new char[] dot.gif{':'});
InBlock.gif                
return int.Parse(MeetingStateTeam[1].ToString());
ExpandedBlockEnd.gif            }

None.gif            
catch
ExpandedBlockStart.gifContractedBlock.gif            
dot.gif{
InBlock.gif                
return 3;
ExpandedBlockEnd.gif            }

None.gif            
finally
ExpandedBlockStart.gifContractedBlock.gif            
dot.gif{
InBlock.gif                s.Close();
ExpandedBlockEnd.gif            }

转载于:https://www.cnblogs.com/hanguoji/archive/2006/08/09/472004.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值