N
Nicolas Ghesquiere
Hello
I have a problem with my current program.
The meaning of the program is to allow users to login to a server to allow
them to access the internet.
My program communicates with a MS isa server to make a rule for that IP for
the time-credits left for that user.
My problem is that so far, the program can handle everything except more
then one client, and i have done my best, but i can't find a decent solution
to get my winsock multithreaded.
i'll show you my code:
Code:
#Region " Windows Form Designer generated code "
Friend WithEvents Winsock3 As Winsock_Control.Winsock
Friend WithEvents Winsock1 As Winsock_Control.Winsock
Friend WithEvents Winsock2 As Winsock_Control.Winsock
'......
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.Winsock1 = New Winsock_Control.Winsock
Me.Winsock2 = New Winsock_Control.Winsock
Me.Winsock3 = New Winsock_Control.Winsock
'....
End Sub
#End Region
Private Sub Winsock1_ConnectionRequest(ByVal sender As
Winsock_Control.Winsock, ByVal requestID As System.Net.Sockets.Socket)
Handles Winsock1.ConnectionRequest
Winsock3.Accept(requestID)
Winsock3.Send("Connected")
txtlog.Text &= "[" & Now.ToLocalTime & "] (" &
Winsock3.RemoteHostIP() & ") Incoming Connection..." & ControlChars.CrLf
End Sub
Private Sub startlisten()
'initialised under form_load ofcourse
Winsock1.Listen()
txtlog.Text &= "Listening..." & ControlChars.CrLf
End Sub
Private Sub Winsock3_DataArrival(ByVal sender As
Winsock_Control.Winsock, ByVal BytesTotal As Integer) Handles
Winsock3.DataArrival
Dim s As String
Dim str As String
Dim pass As String
Dim login As String
Dim IP As String
Dim oRijndael As New Rijndael("[filtered away :] ]")
Dim substr As String = "!!_!_!!"
Winsock3.GetData(s)
IP = Winsock3.RemoteHostIP
login = s.Substring(0, s.IndexOf(substr))
pass = oRijndael.Decrypt(s.Substring(s.IndexOf(substr) + 7),
"[filtered away :] ]")
txtlog.Text &= "[" & Now.ToLocalTime & "] (" &
Winsock3.RemoteHostIP() & ") Incoming data...: LOGIN=" & login & "" &
ControlChars.CrLf
txtlog.Text &= "[" & Now.ToLocalTime & "] (" &
Winsock3.RemoteHostIP() & ") Incoming data...: PASSWORD=[encrypted]" &
s.Substring(s.IndexOf(substr) + 7) & "" & ControlChars.CrLf
'send login , pass & ip for verification
loggebruikerin(login, pass, IP)
'End If
End Sub
Any help would be very welcome, because i'm really stuck with this project
.
I have a problem with my current program.
The meaning of the program is to allow users to login to a server to allow
them to access the internet.
My program communicates with a MS isa server to make a rule for that IP for
the time-credits left for that user.
My problem is that so far, the program can handle everything except more
then one client, and i have done my best, but i can't find a decent solution
to get my winsock multithreaded.
i'll show you my code:
Code:
#Region " Windows Form Designer generated code "
Friend WithEvents Winsock3 As Winsock_Control.Winsock
Friend WithEvents Winsock1 As Winsock_Control.Winsock
Friend WithEvents Winsock2 As Winsock_Control.Winsock
'......
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.Winsock1 = New Winsock_Control.Winsock
Me.Winsock2 = New Winsock_Control.Winsock
Me.Winsock3 = New Winsock_Control.Winsock
'....
End Sub
#End Region
Private Sub Winsock1_ConnectionRequest(ByVal sender As
Winsock_Control.Winsock, ByVal requestID As System.Net.Sockets.Socket)
Handles Winsock1.ConnectionRequest
Winsock3.Accept(requestID)
Winsock3.Send("Connected")
txtlog.Text &= "[" & Now.ToLocalTime & "] (" &
Winsock3.RemoteHostIP() & ") Incoming Connection..." & ControlChars.CrLf
End Sub
Private Sub startlisten()
'initialised under form_load ofcourse
Winsock1.Listen()
txtlog.Text &= "Listening..." & ControlChars.CrLf
End Sub
Private Sub Winsock3_DataArrival(ByVal sender As
Winsock_Control.Winsock, ByVal BytesTotal As Integer) Handles
Winsock3.DataArrival
Dim s As String
Dim str As String
Dim pass As String
Dim login As String
Dim IP As String
Dim oRijndael As New Rijndael("[filtered away :] ]")
Dim substr As String = "!!_!_!!"
Winsock3.GetData(s)
IP = Winsock3.RemoteHostIP
login = s.Substring(0, s.IndexOf(substr))
pass = oRijndael.Decrypt(s.Substring(s.IndexOf(substr) + 7),
"[filtered away :] ]")
txtlog.Text &= "[" & Now.ToLocalTime & "] (" &
Winsock3.RemoteHostIP() & ") Incoming data...: LOGIN=" & login & "" &
ControlChars.CrLf
txtlog.Text &= "[" & Now.ToLocalTime & "] (" &
Winsock3.RemoteHostIP() & ") Incoming data...: PASSWORD=[encrypted]" &
s.Substring(s.IndexOf(substr) + 7) & "" & ControlChars.CrLf
'send login , pass & ip for verification
loggebruikerin(login, pass, IP)
'End If
End Sub
Any help would be very welcome, because i'm really stuck with this project
.