请教:关于服务端与客户端断开后不能再连接的问题!
一个winsock:
代码如下:
init:
IF this.object.localip=='192.168.0.8'
if this.object.state<>0
this.object.clos
endif
this.object.localport=5279
this.object.listen
ENDIF
closed:
IF this.object.state<>0
this.object.clos
ENDIF
IF this.object.localip='192.168.0.8'
this.object.localport=5279
this.object.listen
ENDIF
MESSAGEBOX('客户已经关闭连接')
connectionrequest:
LPARAMETERS requestid
IF this.object.state<>0
this.object.clos
endif
this.object.accept(requestid)
do while this.object.state<>7
doevents
ENDDO
MESSAGEBOX(已经连接上啦')
dataarrival:
LPARAMETERS bytestotal
data=space(bytestotal)
this.object.getdata(@data)
MESSAGEBOX(data)
两个按钮:
连接到服务器按钮的click:
IF this.Parent.olecontrol0.object.localip<>'192.168.0.8'
if this.Parent.olecontrol0.object.state<>0
this.Parent.olecontrol0.object.clos
this.Parent.olecontrol0.object.closed
endif
this.Parent.olecontrol0.object.localport=5279
this.parent.olecontrol0.object.connect('192.168.0.8',5279)
ENDIF
断开连接的click:
this.Parent.olecontrol0.object.clos
this.Parent.olecontrol0.object.closed
目前连接服务器和断开连接在第一次运行时没有问题,但当我断开连接试图再连接时却没有反应了,请高手指点!谢谢!