Is there a winsock class with options: connect, accept, send, recv, etc. ??
other than Wokawidgets[his doesnt work in .dll format, it errors like failed to initialize 0x0000005])
Printable View
Is there a winsock class with options: connect, accept, send, recv, etc. ??
other than Wokawidgets[his doesnt work in .dll format, it errors like failed to initialize 0x0000005])
If you have access to VB.NET you may want to check that out. That can definitely do what you're looking for.
As far as networking in VB6, I'm only personally aware of the Winsock control you put on a form.
But hey! You can make a form in an Active X dll. Just make it invisible.
You can find many links for winsock, in VB. It is a component that you can add to your project, and contains the functions that you posted. Woka added them to a dll, but you don't have to. Search for CHAT PROGRAM, and you'll find many links. I think you would look in the Networking Forum.
When I do that using the Winsock control and call it doing "Msgbox Form1.Winsock1.LocalIP" it just simply doesn't work at all. And when I do it with showing the form it errors "Out of Memory".Quote:
Originally Posted by umilmi81
Thus why I cannot use components in DLL :mad:
I have searched and searched countless forums, websites, etc. for the last 4-5 months and have yet to find a GOOD vb6 winsock class that works and doesn't error when used in a DLL(no .exes involved) - like I stated in my first post.
I guess I will just have to give up on this idea. :sick:
Here is PINO's example. Try each project separately, so that you can connect to yourself, unless you compile on two different machines, and change the IP address on both for send/receive. 39npeople have downloaded this so far. Thanks, PINO
http://vbforums.com/attachment.php?attachmentid=41575
That link just shows a .JPG file :lol:
Patients grasshopper.
This is VBForums.com. The answers will come.
Check this out. How are you accessing the form? Don't try to access the form in the Active X DLL directly. Write a property or a function. I was able to get the IP from the winsock control inside active X dll.
This will be a little tricky if you're not used to Active X development, but it is doable.
Inside the class of the ActiveX DLL, I have this code:
VB Code:
Public Property Let RemoteHost(Value As String) Form1.Winsock1.RemoteHost = Value End Property Public Property Get RemoteHost() As String RemoteHost = Form1.Winsock1.RemoteHost End Property
Inside the calling application I have this code
VB Code:
Dim mycls As Project1.Class1 Set mycls = New Project1.Class1 mycls.RemoteHost = "test.com" MsgBox mycls.RemoteHost
Oops. Try this one. I've deleted the jpg.
http://vbforums.com/attachment.php?attachmentid=38218
I know the above is different from what you posted but It errors "Wrong number of arguments or invalid property assignment" on the bold.VB Code:
Public Property Let LocalIP(Value As String) Form1.Winsock1[b].LocalIP =[/b] Value End Property Public Property Get LocalIP() As String LocalIP = Form1.Winsock1.LocalIP End Property
dglienna, that is the Winsock Control and I need a Class. Thanks for trying though :thumb:
Quote:
Originally Posted by Tantrum3k
That statement will error out even if it's not in the Active X control. I don't know a lot about the Winsock control, but I know a fair bit about ActiveX DLL's. If you have a working stand alone application that uses the Winsock, we should be able to help you get it ported to an ActiveX DLL.
My .dll is different than the normal vb6 behavior. I use an add-in called "vbAdvance"( http://www.vbadvance.com ) that allows vb6 to create standard Win32 DLL's that export functions - which works perfect.
But if you want to test it before posting it back to me - you will have to download and install the vbAdvance add-in. (What you do is get an .exe program developed in another language and attach your vb6 .dll to it so it loads with it, which is easy to do)
I'll attach the project to this thread in hopes that you guys can perhaps help me out a bit with my task. :thumb:
You'd have to contact the author of that code. We can't support it, even if you have the source code, which I haven't even checked. I don't think it's even necessary to have 4 commands in winsock.
All I need to know how to do is what umilmi81 has done in his ActiveX DLL with the Form and Winsock control. I can take care of the rest.
Ok, I went the extra mile for you here.
Attached is the dg's client converted to an ActiveX DLL.
I'm not happy with how I process the data received event, but the data send is good.
This is certainly enough to get you rolling.
Now why would you want to do that? COM is http://www.vbforums.com/images/ieimages/2005/09/1.gifQuote:
Originally Posted by Tantrum3k
My dll only has one form which is the one inside itself - doesn't use .exe. Will this still work? because it's erroring "Out of Memory" again :sick:
I like the fact that vb6 dll's can now export functions so I don't have to do C++ :thumb:Quote:
Originally Posted by umilmi81
there is something out there called CSocketMaster.
It is a class for doing the stuff the Winsock control does
http://www.freevbcode.com/ShowCode.asp?ID=6485
Is there an advantage to that? Besides no ocx?Quote:
Originally Posted by moeur
I have tried CSocketMaster but I can't get the Connect to work properly neither in .dll format also.
I tried:
It always returns sckConnecting and doesn't do anything else (even when the server is up) and returns sckConnecting and doesnt do anything else instead of returning sckError when the server is down.VB Code:
mSocket.Connect "66.66.66.66", 9800 If mSocket.State = sckError Then MsgBox "Cant connect" End If If mSocket.State = sckConnected Then MsgBox "Connected" End If MsgBox mSocket.State 'always returns sckConnecting
Could someone post a good test example using CSocketMaster with DataArrival, Connect, Accept, SendData, GetData, etc. ? :bigyello:
The two main advantages are, no OCX and you get the source code to play around with.Quote:
Is there an advantage to that? Besides no ocx?
Tantrum, Did you run the examples the code comes with?
It works in .exe but fails to work in .dll.
In .exe when trying to connect to a server that ISN'T up, it says Connection refused - like it should. When in .dll, it just continues to do nothing.
Is there anyway that the client can terminate the connection ?