|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Winsock.Accept - Im pushing my luck a bit!
Hi guys, I was wondering if the following is possible, because I cant seem to do it right...
I have a winsocket in one application that is constantly listening for connections... Code:
Listener.Close Listener.LocalPort = 90 When it does eventaully receive a connection request, I have the connection accepted by a different socket on the same form... Code:
Private Sub Listener_ConnectionRequest(ByVal requestID As Long) WAN.Close WAN.Accept RequestID End Sub ...you with me? the above code works fine, but I want to take it to the next level... Basically, I want a winsocket from an external ActiveX EXE to accept the conection. For example, lets say I have an application called 'Main.exe', and all it does is listen for connections. Then I've got another application called 'Sub.exe' (an activeX exe), and it accepts the connection requets. I thought that the follwonig code would work, but it doesnt... Code:
' MAIN.EXE Code ('Sender' has already been declared as an Object)
Private Sub Listener_ConnectionRequest(ByVal requestID As Long)
Set Sender = Nothing
Set Sender= CreateObject("Sender.Send")
Sender.Accept requestID
End Sub
Code:
' SUB.EXE Code AKA "Sender.Send" Public Sub Accept(requestID As Long) Load Form1 Form1.Show Form1.WAN.Close Form1.WAN.Accept requestID End Sub 'In case you hadn’t already guessed, SUB.EXE has a form on it called form1, with a winsock control called WAN Is what I am trying to do even possible? At the moment the code it is returung the error at the point Form1.WAN.Accept requestID, and it says 'The descriptor is not a socket'.
__________________
LozWare Website Directory Whooo! Free submissions, no recip needed. I'm a nice guy
Last edited by LozWare : April 6th, 2006 at 04:33 AM. |
|
#2
|
||||
|
||||
|
Come on, there must be some advanced VB programmers on here!!! ;-)
|
|
#3
|
|||
|
|||
|
I don't understand what you're trying to accomplish.
Even if I did understane, other than one misguided adventure a few years ago, I've managed to never venture into winsock programming in VB ![]()
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#4
|
||||
|
||||
|
Simply put: I want 2 seperate proccesses. One listens for the connections, and the other one accepts the connection requests.
|
|
#5
|
|||
|
|||
|
Maybe you're looking for some kind of port forwarding, which I have no idea how to implement.
|
|
#6
|
||||
|
||||
|
I'll let you in a bit more on what I am trying to do:
I am making a server, which obviously consists of a program that listens for connections. When a new connection is made, the server and the client can begin the exchange data. However, as more sessions are made, the server will begin to lag, and sooner or later it will get a stack-overflow. So, I still want the server to listen for the connections, but I want a separate process for each session. So if one session crashes (for some unknown reason) then the rest of the server will run fine (because the session would be isolated in its own process). There are quite a few servers that function like this, and I thought that the best way to do it is the way that I am trying to do (but I can’t seem to do it!) |
|
#7
|
|||
|
|||
|
Hopefully there is some socket programming guru that can help. The only winsock I ever did used a free tool called socketwrench, which came with examples on how to set up a server that properly accepts multiple connections. This was quite a few years ago, I have no idea if socketwrench is still available.
You should not accept code that causes a stack overflow over time, something else is wrong. |
|
#8
|
||||
|
||||
|
Quote:
That is one of the hardest parts of building a server; you have to get the combination of performance and stabilty correct. I could easily build a server that would keep on running for as long as the PC is turned on; but it would be pretty slow at transferring data in order to prevent the stack-overflows. However, when you start building high-performance servers that transfer data very quickly, then that is where the stack-overflow issue starts to take effect. The telnet server I wrote some time ago is very stable and would never crash due to an overflow - but that is only because it bottlenecks all if the inbound and outbound traffic, which actaully makes it quite slow. But because its only a telnet server, you dont need to transfer data at lighteneing speeds, and you cant actaully notice any lack of speed. Buildinbg servers is fun, but it gets your head going! |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Winsock.Accept - Im pushing my luck a bit! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|