标题:winsock senddata问题(已解决)
取消只看楼主
卡卡希比
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:2283
专家分:189
注 册:2007-7-1
结帖率:70%
 问题点数:0 回复次数:4 
winsock senddata问题(已解决)

server如何接收

client的代码如下


Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Private Sub client_Connect()
MsgBox "连接成功"
End Sub

Private Sub client_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox "连接错误,请检察网络设置,或服务器没有启动,请关闭重试"
client.Close
End Sub

Private Sub Command1_Click()
client.SendData strString
End Sub

Private Sub Form_Load()
client.RemoteHost = "192.168.1.251"
client.RemotePort = 8612
client.Connect
Dim strString As String
strString = String(255, Chr$(0))
GetComputerName strString, 255
strString = Left$(strString, InStr(1, strString, Chr$(0)) - 1)
End Sub





server的代码如下

Private Sub Form_Load()
server.LocalPort = 8612
server.Bind
server.Listen
End Sub

Private Sub server_Close()
server.Close
server.Listen
End Sub

Private Sub server_DataArrival(ByVal bytesTotal As Long)
Dim strstring As String
server.GetData strstring, vbString
Text1.Text = strstring + Chr$(13) + Chr$(10) + Text1.Text
End Sub

[此贴子已经被作者于2007-8-4 10:09:13编辑过]

搜索更多相关主题的帖子: senddata winsock 
2007-08-03 12:37
卡卡希比
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:2283
专家分:189
注 册:2007-7-1
得分:0 

不知道,如何收接client的strstring 并显示在server中的text1.text中


PLEASE FLUSH AFTER USE!
2007-08-03 12:44
卡卡希比
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:2283
专家分:189
注 册:2007-7-1
得分:0 
我两个程序是分开的,

PLEASE FLUSH AFTER USE!
2007-08-03 12:51
卡卡希比
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:2283
专家分:189
注 册:2007-7-1
得分:0 

我到百度查了一下request
ASP的多,确认一下,LS是不是发错地方了


PLEASE FLUSH AFTER USE!
2007-08-03 13:26
卡卡希比
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:2283
专家分:189
注 册:2007-7-1
得分:0 
没有会,还是没人愿意回答

PLEASE FLUSH AFTER USE!
2007-08-03 23:33



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-160104-1-1.html




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

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