Article View: cn.bbs.comp.lang.visual-basic
Article #20635Re: ����winsock�Զ����ӷ���������.
From: ����å->�����
Date: Sat, 09 Aug 2003 04:18
Date: Sat, 09 Aug 2003 04:18
72 lines
4158 bytes
4158 bytes
��λ��һ�°����Dz���winsock���Ҷ����timer�¼���
�����ˣ�һֱ���ڽ��������״̬��û�еȵ�timer�ĵڶ���ִ�У�
�� �� lijie1981 (����å->�����) �Ĵ������ᵽ: ��
˼·:
��form1�з���һ��timer����timer��ѭ������winsock��״̬.
��winsock״̬Ϊ�رա�
�����ӷ�����,��ʱ��ͣѭ��������winsock��״̬,ֱ�����ӳɹ�.
���ӳɹ���ͷ����û��������.
����:
���������رպ���С��timer��intervalʱ���У��������Ϸ�����.
������interval����winsock��״̬һֱ��"��������"!
���ʸ�λ������Ϊʲô�أ����ҳ���д�ģ�����Ǵ��ڽ�������
״̬�Ļ����ҾͰ���close�ˡ�Ҳ����˵��һ��intervalʱ�䵽��
ʱ��winsock��״̬Ӧ�ö��ǹرյİ�����Ϊʲôһֱͣ����"����
�����أ�"
��������:
Private Sub Timer1_Timer()
Select Case Winsock1.State
Case sckConnected
Form1.Caption = "�Ѵ�������״̬"
Timer1.Enabled = False '��ʱ������Ҫ�ټ����.
Exit Sub
Case sckClosed
'����ѻ���������.
Winsock1.Close
Form1.Caption = "���������ӷ�����,���Ժ�!"
Winsock1.RemoteHost = "202.202.41.180"
Winsock1.RemotePort = 3333
Winsock1.Connect
Do Until Winsock1.State = 7 '�ڴˣ���ͣ�ļ��winsock��״̬.֪����
������Ϊֹ.
DoEvents '��������Ȩ.
Loop
'///////////////////////
Winsock1.SendData "lwu" & Form2.txtName & "lwu" & Form2.txtPwd
Case Else
Winsock1.Close
Form1.Caption = "���������ӷ�����,���Ժ�!"
Winsock1.RemoteHost = "202.202.41.180"
Winsock1.RemotePort = 3333
Winsock1.Connect
Do Until Winsock1.State = 7 '�ڴˣ���ͣ�ļ��winsock��״̬.֪������
����Ϊֹ.
'����������ӣ�������Ϣ����ʾ���ӳɹ�.
'����winsock��״̬. 0 is closed, 9 is error
DoEvents
Loop
Winsock1.SendData "lwu" & Form2.txtName & "lwu" & Form2.txtPwd
End Select
'��ִ�е���һ����˵�������Ѿ�����.
Form1.Caption = "�Ѵ�������״̬"
Timer1.Enabled = False '�Ѿ��������ˣ�������ִ��timer�¼�..
End Sub
--
[36m�� ��:��lijie1981 �� Aug 3 17:44:06 �ı��ġ�[FROM: 202.202.43.121][m
--
[m[1;31m�� ��Դ:��BBS ˮľ�廪վ smth.org��[FROM: 202.202.43.121][m
Technical Details
Message-ID:
<000000$2bB@smth.org>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!38.144.126.76.MISMATCH!feed2.newsreader.com!newsreader.com!maily.cic.tsinghua.edu.cn!SMTHShow Full Headers
Complete Article Headers
X-Google-Language: Chinese,GB X-Google-Thread: 10a1a8,a4979f33ce04f55e,start X-Google-Attributes: gid10a1a8,public X-Google-Thread: 109fdd,a4979f33ce04f55e,start X-Google-Attributes: gid109fdd,public X-Google-ArrivalTime: 2003-08-08 21:20:05 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!38.144.126.76.MISMATCH!feed2.newsreader.com!newsreader.com!maily.cic.tsinghua.edu.cn!SMTH From: lijie1981@smth.org (����å->�����) Newsgroups: cn.bbs.comp.lang.visual-basic Subject: Re: ����winsock�Զ����ӷ���������. Date: 09 Aug 2003 04:18:29 GMT Organization: BBS ˮľ�廪վ Message-ID: <000000$2bB@smth.org> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit X-Filename: VisualBasic/l/M.1060402575.30 Lines: 72