Re: Connecting a Newsserver
General declarations:
(C) Peter Rachow
Option Explicit
Global Const APPNAME = "Newsmodule"
Global lngSecs As Long
Global intRxModeNMTP As Integer
Global strRecMsgID As String
Global lngLastArticleInGroup As Long
Global strWinsockNMTP As String
'Const for Winsock
Global Const RXM_CONNECT = 1
Global Const RXM_GROUPINFO = 2
Global Const RXM_GETSTAT = 3
Global Const RXM_GETHEADER = 4
Global Const RXM_GETBODY = 5
Global Const RXM_POST = 10
Global Const RXM_POSTDONE = 11
Global Const RXM_GETGROUPLIST = 12
Global Const RXM_CANCEL = 99
Global Const RXM_QUIT = 100
Global Const TIMEOUTSECS = 30
'Const for Grouplist
Global intGroupListMode As Long
Global Const GRPLISTLONG = 1
Global Const GRPLISTSHORT = 0
Use this code in a seperate module!
"Program Files from the NET" <prgr@netprog.com> schrieb im Newsbeitrag
news:jeuufh$2ge$1@speranza.aioe.org...
> Found a cool Function to connect to e NMTP-Server (C) Peter Rachow from
> germany
>
> Function ConnectServer(strServer As String) '(C) 2009 Peter Rachow
>
> Dim lngSecsOld As Long
>
> Call SysMsg("Connecting: " & strServer)
> If frmMain.wskNMTP.State = sckClosed Then
> frmMain.wskNMTP.RemotePort = 119
> frmMain.wskNMTP.RemoteHost = strServer
> frmMain.wskNMTP.Connect
> intRxModeNMTP = RXM_CONNECT
> lngSecsOld = lngSecs
>
> Do While intRxModeNMTP = RXM_CONNECT
> DoEvents
> If lngSecs > lngSecsOld + TIMEOUTSECS Then
> frmMain.wskNMTP.Close
> Call SysMsg("Time out.")
> ConnectServer = 0
> Exit Function
> End If
> Loop
> Else
> Call SysMsg("Connection alredy exists.")
> ConnectServer = 0
> Exit Function
> End If
>
> ConnectServer = 1
>
> End Function
>
> You need a Winsock-Control wskNMTP and a function to Show SysMsgs (can
> either be a MsgBox or e listbox or sth).
>
> Have fun!
>
Fnews-brouse 1.9(20180406) -- by Mizuno, MWE <mwe@ccsf.jp>
GnuPG Key ID = ECC8A735
GnuPG Key fingerprint = 9BE6 B9E9 55A5 A499 CD51 946E 9BDC 7870 ECC8 A735