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
:) . 1 5393
I did something similar in a program that accepts multiple simultaneous
connections from SMTP mail servers. You might want to download it and take a
look at the code and how I implemented multi-threading (it's open source): http://spamgrinderprox.sourceforge.net/
"Nicolas Ghesquiere" <th*******@skynet.bewrote in message
news:44**********************@news.skynet.be...
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 :)
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: dixp |
last post by:
I'm new to writing multithreaded apps and I have a design question. I
have a winforms app and a class which has a method that does processing
which is time intensive. I want the user to be able...
|
by: Mark Yudkin |
last post by:
The documentation is unclear (at least to me) on the permissibility of
accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003,
with separate transactions scope, from separate...
|
by: Robert Zurer |
last post by:
Can anyone suggest the best book or part of a book on this subject. I'm
looking for an in-depth treatment with examples in C#
TIA
Robert Zurer
robert@zurer.com
|
by: Nadav |
last post by:
Hi
I am writing some kind of a storage system that have to deal with large amounts of data passing over the net, Now, I Wonder... traditional programming would use win32 Winsock DLL as the means...
|
by: Rich |
last post by:
Hello,
I have set up a multithreading routine in a Test VB.net
proj, and it appears to be working OK in debug mode and I
am not using synchronization. Multithreading is a new
thing for me, and...
|
by: kc |
last post by:
Hi
Just upgrading a app from VB6 to VB.Net. All is going well apart from the
Winsock control.
The first thing we notice is that there does not appear to be a .Net version
(please correct me if...
|
by: gnanapoongothai |
last post by:
hi,
i have to develope a client sever modal in which around 32 clients will be connected and send data at 1MBps rate. the sever has to store it in hard after alligning it. so for this scenario...
|
by: imaloner |
last post by:
I am posting two threads because I have two different problems, but both have the same background information.
Common Background Information:
I am trying to rebuild code for a working,...
|
by: AaronL |
last post by:
Hello,
I am currently working on a project that has me in sort of a bind. What I want to do is retrieve web pages from the internet, and strip them down to just text. I'll get using Regular...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
| |