|
-
Aug 12th, 2005, 03:41 PM
#1
Re: Socket Issue
Regarding to the post you edited 
sockaddr.sin_addr = 66
sockaddr.sin_addr = 66 ' this just overides the previous 66, therefore you end up with 66 in the end, not "66.66.66.66"...
I did not test it, but I think this is the API that converts from string address to a Long
VB Code:
Public Declare Function inet_addr Lib "ws2_32.dll" (ByVal cp As String) As Long
EDIT, Here's the MSDN help for it MSDN - inet_addr
You have to use it like:
VB Code:
Dim server As sockaddr
server.sin_addr = inet_addr("66.66.66.66")
If (Connect(MySocket, server, Len(server))) = SOCKET_ERROR Then
'... the rest of the code
-
Aug 12th, 2005, 04:02 PM
#2
Thread Starter
Hyperactive Member
Re: Socket Issue
Also, in regards to the comment you made about puting the winsock control on a form hidden in your dll. I just did that it works fine without errors but when I try calling it in a Module like:
VB Code:
Dim ip As String
ip = Form1.Winsock1.LocalIP
MsgBox ip
It just exits the DLL. Closes it immediately without reason.
So I take it it's not going to happen, eh? 
EDIT:
VB Code:
Dim server As sockaddr
server.sin_addr = inet_addr("66.66.66.66")
If (Connect(MySocket, server, Len(server))) = SOCKET_ERROR Then
Do you know how I can somehow put a port in there too for it to connect to also?
Last edited by Tantrum3k; Aug 12th, 2005 at 04:08 PM.
-
Aug 12th, 2005, 04:17 PM
#3
Re: Socket Issue
 Originally Posted by Tantrum3k
VB Code:
Dim ip As String
ip = Form1.Winsock1.LocalIP
MsgBox ip
Try without displaying the ip in the message box... a DLL is not supposed to have an interface, than's why I told you to make the form.Visible = False
 Originally Posted by Tantrum3k
Do you know how I can somehow put a port in there too for it to connect to also?
VB Code:
Dim server As sockaddr
server.sin_port = 80 ' or some other port...
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
|