Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 5th, 2006, 10:10 AM
LozWare's Avatar
LozWare LozWare is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jun 2005
Posts: 531 LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 10 h 56 m 31 sec
Reputation Power: 46
Send a message via MSN to LozWare
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.

Reply With Quote
  #2  
Old April 6th, 2006, 01:42 PM
LozWare's Avatar
LozWare LozWare is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jun 2005
Posts: 531 LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 10 h 56 m 31 sec
Reputation Power: 46
Send a message via MSN to LozWare
Come on, there must be some advanced VB programmers on here!!! ;-)

Reply With Quote
  #3  
Old April 6th, 2006, 02:24 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
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

Reply With Quote
  #4  
Old April 6th, 2006, 03:29 PM
LozWare's Avatar
LozWare LozWare is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jun 2005
Posts: 531 LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 10 h 56 m 31 sec
Reputation Power: 46
Send a message via MSN to LozWare
Simply put: I want 2 seperate proccesses. One listens for the connections, and the other one accepts the connection requests.

Reply With Quote
  #5  
Old April 8th, 2006, 04:07 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
Maybe you're looking for some kind of port forwarding, which I have no idea how to implement.

Reply With Quote
  #6  
Old April 8th, 2006, 05:27 PM
LozWare's Avatar
LozWare LozWare is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jun 2005
Posts: 531 LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 10 h 56 m 31 sec
Reputation Power: 46
Send a message via MSN to LozWare
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!)

Reply With Quote
  #7  
Old April 8th, 2006, 08:06 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
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.

Reply With Quote
  #8  
Old April 9th, 2006, 02:42 PM
LozWare's Avatar
LozWare LozWare is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jun 2005
Posts: 531 LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level)LozWare User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 10 h 56 m 31 sec
Reputation Power: 46
Send a message via MSN to LozWare
Quote:
You should not accept code that causes a stack overflow over time, something else is wrong.


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!

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Winsock.Accept - Im pushing my luck a bit!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT