| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 573 人关注过本帖
标题:谁能帮我一下忙那里出错了 谢谢
只看楼主 加入收藏
zdc582047
Rank: 1
来 自:广东汕尾
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-12-7
收藏
 问题点数:0 回复次数:1 
谁能帮我一下忙那里出错了 谢谢
Private Sub Command2_Click()
Winsock2.SendData Text2.Text
End Sub
Private Sub Timerl_Timer()
Labell.Caption = GetState(Winsock1.State)
Label2.Caption = GetState(Winsock2.State)
End Sub
Private Function GetState(tmp As Long) As String
Select Case tmp
Case 0
GetState = "默认的。关闭"
Case 1
GetState = "打开"
Case 2
GetState = "侦听"
Case 3
GetState = "连接挂起"
Case 4
GetState = "识别主机"
Case 5
GetState = "已识别主机"
Case 6
GetState = "正在连接"
Case 7
GetState = "已连接"
Case 8
GetState = "同级人员正在关闭连接"
Case 9
GetState = "错误"
End Select
End Function
Private Sub Form_Long()
Winsock1.LocalPort = 65500
Winsock1.Listen
'开启侦听
Winsock2.RemoteHost = "127.0.0.1"
'表示服务器主机名
Winsock2.RemotePort = 65500
'表示服务器端口
Winsock2.Connect
'连接到服务器
End Sub
Private Sub Form_Unload(Cancel As Integer)
Winsock1.Close              ← 这里怎么该啊
End Sub
Private Sub Winsock1_Close()
     Winsock1.Close
     Winsock2.Close
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
End Sub
Private Sub Winsock2_Close()
Winsock2.Close
End Sub
Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
    Dim s As String
    Winsock2.GetData s
        Text2.Text = s
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
   Dim s As String
   Winsock1.GetData s
     Text1.Text = s
End Sub
Private Sub Command1_Click()
Winsock1.SendData Text1.Text
End Sub


大哥大姐 帮帮忙


[ 本帖最后由 zdc582047 于 2010-12-17 14:56 编辑 ]
搜索更多相关主题的帖子: 主机 
2010-12-15 14:40
xiaoji756
Rank: 1
等 级:新手上路
帖 子:8
专家分:2
注 册:2011-3-29
收藏
得分:0 
你要用它干什么呀
2011-04-08 18:11
快速回复:谁能帮我一下忙那里出错了 谢谢
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.042673 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved