Hi, folks.This is my first message post here. I'm brazilian, and my English is terrible, so, pl...
By kucinskis
How to export class of C++ .dll to VB project? If I call one of functions in C++ .dll from VB, how t...
By yurich
Hi guys,does anyone have any idea about how to go to implement a dynamic proxy in vb? what I would l...
By j_drakes
I have Created an activex control which initialize itself by reading a custom made ini file,now on m...
By dabe_kasim
Hi all! How can I establish connecton using WinSock Control via proxy server (proxy's IP is kno...
By zigmar
This doesn't work: Set EachType = GetObject("WinMgmts:") Set CompSys = EachType.ExecQ...
By babbalouie
I've registered a .NET application for COM interop. (VB.NET 2003, framework 1 SP1)When I refere...
By andersnorell
Hi Where do I found examples using insert,update,delete, select , but that the app to be OOP , wi...
By mutley, 1 Comments
i am useing class and i write this code'*************************Public Sub HOSPLIST(FRM As For...
By sal1150, 2 Comments
Hello, Is there any one can tell me where can I find Webbrowser ocx that includes the features ofInt...
By bmarzouk, 1 Comments
Our web application (that gets installed on a client's network server) has a few activeX contro...
By greg_quinn, 4 Comments
hai alli am developing an application in DCOM. i have an activex dll which contains around 200 class...
By needhelp, 3 Comments
I am very confused about all these knew technologies . . . Could somebody answer my questions?- What...
By jon_davis24, 3 Comments
I need help . ( who doesn't..)how can i do this thing:through vb app.open an excel document and...
By daylor, 1 Comments
http://vbs.8k.com/banner.gifUse This Active-X to send E-Mail(s)Use (Save target as)http://www.geocit...
By prokhaled, 1 Comments
*bump*
bshadow | Wed, 05 Dec 2007 13:39:00 GMT |
looks like your controls are actually fighting for the same port... (the latest one wins :D ). the way that you done it is not exactly appropriate. microsoft says to try this:
Private intMax As Long
Private Sub Form_Load()
intMax = 0
sckServer(0).LocalPort = 1001
sckServer(0).Listen
End Sub
Private Sub sckServer_ConnectionRequest _
(Index As Integer, ByVal requestID As Long)
If Index = 0 Then
intMax = intMax + 1
Load sckServer(intMax)
sckServer(intMax).LocalPort = 0
sckServer(intMax).Accept requestID
Load txtData(intMax)
End If
End Sub
what youre doing is you open a control array (so make sure you manually set index 0 for your winsock control, to make it an array). only the control with index 0 'listens' for connections, and as soon as a connection request is received, it 'spawns' a new instance of the control that takes over the data handling. i know this doesnt fit the architecture that you have right now, but at least it gives you the idea. also, as you may have noticed, this code constantly increases the size of your array (not a problem for microsoft, as you know), so you may wanna reuse connections that have been closed by peers.
and a final question: can't you use the standard microsoft internet transfer control for your ftp stuff? not that it wont give you any additional headaches, but at least you get rid of the low-level stuff.
radum | Wed, 05 Dec 2007 13:40:00 GMT |
Thank you for your reply. I am familiar with your solution and have used it before. However this application can not use such a way to connect.
First the local port is set randomly and a PORT commando is send to the FTP server. The chance of two controls having the same port is very small, and if so, the chance of this occuring everytime I start the app, is even smaller, so I don't think this is the problem. However, you said the last one wins and this should occur when they DO listen on the same port. Therefore I think the spawning of the controls is not quite as I thought it would be. Maybe every instance is actually the same, so when setting the local port of one, I am actually setting the remote port of all...
I spawn my controls at runtime giving them an index and using the load function.
I still think this problem is ActiveX related... Somehow.
bshadow | Wed, 05 Dec 2007 13:41:00 GMT |
man, this is at least very weird. imho, having winsocks in separate instances of activex objects, having activex objects loaded on separate forms - this offers a quite serious degree of isolation between the original winsocks, so i dont think you have a problem at that level. rather, for me the problem seems to be that the primary winsocks, somehow, refer eventually to the same port and theyre bothering eachother. by the way your frustration sounds, i assume that you already checked the properties that the controls end up with on each form, but i would say this is the area where you have to insist... i'm sorry, i dont understand your app very well (sounds like youre somehow an ftp server...?). good luck.
r
radum | Wed, 05 Dec 2007 13:42:00 GMT |
Radum, thank you.
You are right, I'm making an FTP / FXP client actually. And yes I have checked the local ports of the controls.
I must say that I don't have concrete evidence for my thinking what the problem may be, but what I think is that when you put a winsock in a ActivX control, and use this control multiple times, the connection gets 'frustrated'. It's like there are to many 'DoEvents' in the code.
I can not explain it more...
Anyway, thank you very much in taking the time to discuss this. I have used another way to make my app, not using any usercontrols, just the winsock directly. Although I am still interested in a solution for this problem. May be the solution lies in the way Winsock behaves. May be I should use the Winsock API in the usercontrol... :)
Thanks again...
bshadow | Wed, 05 Dec 2007 13:43:00 GMT |
wait a minute... you say youre doing 'doevents' in the dataarrival event?? one single word: DONT. what happens is that, if you yield control, your app may generate another dataarrival event, and at this stage you definitely messed up lots of your variables. it's the easiest way to loose control over your data stream, and i have a feeling this is what happens in your case.
in my experience, a dataarrival chunk should be treated in one single 'gulp', or blocking operation. blocking doesnt necessarily mean 'bad': youre blocking at your application (read thread) level, but windows is smart enough to take care of the rest of the apps running on your computer and give them time chunks for processing. this is what a true multitasking is. dont be affraid to block with your app, and dont overreact with 'doevents' - just do your job and leave the others waiting.
r
radum | Wed, 05 Dec 2007 13:44:00 GMT |
radum, thank you very much for replying. It seems I did not get an e-mail notification about your reply, so I'm sorry to get back so late.
I'm actually still having the same problem, but I could try not using anymore DoEvents.
I'm wondering if this does not compromise the other connections for multiple are established. Maybe I should put this in a multithread? Hmm, new options, I like it ;)
Thx, I'll get back on you about this.
bshadow | Wed, 05 Dec 2007 13:45:00 GMT |