您的位置:程序门 -> vb -> 网络编程



vb winsock 从没见过的问题 ,高手请看....


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


vb winsock 从没见过的问题 ,高手请看....[无满意答案结贴,结贴人:zjweii]
发表于:2007-11-01 22:16:27 楼主
我用winsock控件做了一个服务器,一个客户机,都放在本机上运行  
服务器用的是一个winsock控件数组..  

(   首次运行)   能连通  

关掉再运行:失败!!   (没做任何更改!)  

大概5-10分钟后,再运行   能连通!!!  

请问各位大侠,这是为什么?????   有什么解决办法??   是不是关闭时要做一些清扫工作?   怎么清?  
部分代码:  
private   sub   inittcp()  
winsock1(0).localport   =   20007  
winsock1(0).listen  
for   i   =   1   to   maxcomputer  
load   winsock1(i)  
next   i  
end   sub  

private   sub   winsock1_connectionrequest(index   as   integer,   byval   requestid   as   long)  
msgbox   ""  
dim   i   as   integer  

for   i   =   1   to   maxcomputer  
if   winsock1(i).state   =   sckclosed   then  

winsock1(i).accept   requestid  

exit   for  
end   if  
next   i  

end   sub  


private   sub   winsock1_dataarrival(index   as   integer,   byval   bytestotal   as   long)  
dim   temp$  
winsock1(index).getdata   temp  
call   processmsg(index,   temp)  
end   sub
发表于:2007-11-04 10:21:351楼 得分:0
private   sub   form_unload()
winsock1.close
end   sub
发表于:2007-11-06 10:45:522楼 得分:0
关闭一下就可以吗?
遇到过类似的问题,不过不是经常出现,有时打开就行,有时就不行!     唉!


快速检索

最新资讯
热门点击