Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

winsock?

Status
Not open for further replies.

GOOGE

Technical User
Jun 20, 2001
36
NZ
hi guys
im new to this so this may be a stupid question but plz stay with me.

i am running a LAN and have shared internet connection through a proxy server which works fine but the computer that dials the net is only a terminal and i dont have a monitor hooked up to it. the problem i have is that when i have finished with the net i cant get the computer with the internet connection to disconect from the net. i have a messenger VB program running on all mechines on the net.my question is ...

can i somehow in VB tell the internet computer to disconectfom the net. is this posible through the winsock control. if so can u point me into the right direction.

thankyou in advance

James Cuttance
 
This will terminate an Internet connection. You might be able to find a way to use it.

I wish I could site the source for this code (I know that I didn't write it). I seem to have lost the author reference.
[tt]
Const RAS_MAXENTRYNAME = 256
Const RAS_MAXDEVICETYPE = 16
Const RAS_MAXDEVICENAME = 128
Const RAS_RASCONNSIZE = 412
Private Type RasConn
dwSize As Long
hRasConn As Long
szEntryName(RAS_MAXENTRYNAME) As Byte
szDeviceType(RAS_MAXDEVICETYPE) As Byte
szDeviceName(RAS_MAXDEVICENAME) As Byte
End Type
Private Declare Function RasEnumConnections _
Lib "rasapi32.dll" Alias "RasEnumConnectionsA" _
(lpRasConn As Any, _
lpcb As Long, _
lpcConnections As Long) As Long
Private Declare Function RasHangUp _
Lib "rasapi32.dll" Alias "RasHangUpA" _
(ByVal hRasConn As Long) As Long
Private Sub Form_Load()
Dim i As Long
lpRasConn(255) As RasConn
lpcb As Long
Dim lpcConnections As Long
hRasConn As Long
lpRasConn(0).dwSize = RAS_RASCONNSIZE
lpcb = RAS_MAXENTRYNAME * lpRasConn(0).dwSize
lpcConnections = 0
returncode = RasEnumConnections( _
lpRasConn(0), lpcb, lpcConnections)
If returncode = 0 Then
For i = 0 To lpcConnections - 1
If Trim(CStr(lpRasConn(i).szEntryName)) = _
Trim(gstrispname) Then
hRasConn = lpRasConn(i).hRasConn
returncode = RasHangUp(ByVal hRasConn)
End If
Next i
End If
End Sub
[/tt]

VCA.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top