|
-
Oct 7th, 2005, 04:06 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Do I need to use Winsock API in ActiveX DLL?
Hi
I have a VB ActiveX dll app running on ourwebserver. We have a customer that needs to have an XML doc sent to their platform.
Currently they have an app that uses the Winsock control to SendData to their IPAddress using specific Port no. I presume they have a winsock listening on that port at the other end? or coudl they have something else?
I understand how the winsock CONTROL works. However I dont know what is the best way to implement this requirement to send XML doc to their platform as I presume you cannot add a Winsock control to ActiveX DLL (as there is no user interface forms). Do I have to use the Winsock API (I'm not not keen on this as it looks time consuming)? I am familiar with using the XMLHTTP object to POST data. Is this the same concept? Or do I have to stick to Winsock as this is what is listening on the client server?
Many thanks
Kester
-
Oct 7th, 2005, 08:54 AM
#2
Lively Member
Re: Do I need to use Winsock API in ActiveX DLL?
I have used the Winsock control in and ActiveX DLL many times. Within your DLL project, simply add a form, call it "frmDummy". Then, place your Winsock control on the form. Then you can use the following code in within your main class:
VB Code:
Private WithEvents oSock As Winsock
Private Sub Class_Initialize()
Set oSock = frmDummy.Winsock1
End Sub
Private Sub Class_Terminate()
Set oSock = Nothing
End Sub
With this code you can use the Winsock control in your DLL just like you would in any other project.
As to whether this is the best route, it depends. Is the remote machine listening on port 80? Is it expecting an HTTP transaction? If the communication is going to be over HTTP on port 80, then your best bet would probably be to use MSXML since you are already familiar with it.
-
Oct 14th, 2005, 05:49 AM
#3
Thread Starter
Addicted Member
Re: Do I need to use Winsock API in ActiveX DLL?
Thanks for your reply.
I am a bit puzzled as I thought the point of ActiveX dll was that they had no UI and therefore you cannot add a form to the project. However I will investigate further.
I wish I could use the MSXML obj but the customer currently has a Winsock listening on a particular port so I guess this is the only option I have?
Thanks
Kester
-
Oct 14th, 2005, 05:53 AM
#4
Thread Starter
Addicted Member
Re: Do I need to use Winsock API in ActiveX DLL?
Oh OK if I remove 'Unattended execution' from the project properties then I can add the form!
What are the implications of removing 'Unattended execution' - just need to ensure that I dont use any Messages boxes? Would unhandled errors cause msgboxes?
-
Oct 14th, 2005, 09:10 AM
#5
Lively Member
Re: Do I need to use Winsock API in ActiveX DLL?
I know that when I am testing DLLs that I've created like this I have seen an error dialog. Usually though, especially when dealing with network operations, I have very strong error handling built into the code. So, by the time I've taken the DLL to the production stage there isn't any place an unhandled error can occur.
But, to anwer your question, removing the "Unattended Execution" option would mean that unhandled errors would display an error dialog.
Last edited by BradBrening; Oct 14th, 2005 at 09:22 AM.
-
Oct 19th, 2005, 11:43 AM
#6
Thread Starter
Addicted Member
Re: Do I need to use Winsock API in ActiveX DLL?
That seems to do it nicely!
Thx for the help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|