Results 1 to 6 of 6

Thread: how to use winsock.DLL

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2009
    Posts
    21

    Question how to use winsock.DLL

    hi all.
    i always have using winsock.ocx that installed by vb6 !
    but currently a have to create one exe-file to send data without using winsock.ocx.
    the only way i found is winsock.DLL ,but i don't understand how to use this DLL. however some samples i found in :
    http://www.codeguru.com/vb/vb_intern...Winsockdll.htm
    but that was not working too!

    i have a sample link from this address:
    aheads.net/lotus/ajax.php?uname=ghasem&[email protected]&serial=12&mobile=111111

    By passing each new serial to the above link , you have to receive one new password!
    any solution?
    thanx all.

  2. #2
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: how to use winsock.DLL

    Quote Originally Posted by pernia View Post
    however some samples i found in :
    http://www.codeguru.com/vb/vb_intern...Winsockdll.htm
    but that was not working too!
    How is it not working ? Did it crash ? Did it do nothing ? What's wrong with it ?
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: how to use winsock.DLL

    Moved From The CodeBank (which is for sharing code rather than posting questions )

  4. #4
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: how to use winsock.DLL

    Quote Originally Posted by pernia View Post
    hi all.
    i always have using winsock.ocx that installed by vb6 !
    but currently a have to create one exe-file to send data without using winsock.ocx.
    the only way i found is winsock.DLL
    ,but i don't understand how to use this DLL. however some samples i found in :
    http://www.codeguru.com/vb/vb_intern...Winsockdll.htm
    but that was not working too!

    i have a sample link from this address:
    aheads.net/lotus/ajax.php?uname=ghasem&[email protected]&serial=12&mobile=111111

    By passing each new serial to the above link , you have to receive one new password!
    any solution?
    thanx all.
    Weather you use Winsock.OCX or Winsock.DLL you are still using Winsock. Winsock.OCX is a wrapper for Winsock.DLL minus some features to make it simpler to use. So, if you have to make EXE to send data without using Winsock then what kind of data are you talking about. There are APIs to send data.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2009
    Posts
    21

    Post Re: how to use winsock.DLL

    Quote Originally Posted by jmsrickland View Post
    Weather you use Winsock.OCX or Winsock.DLL you are still using Winsock. Winsock.OCX is a wrapper for Winsock.DLL minus some features to make it simpler to use. So, if you have to make EXE to send data without using Winsock then what kind of data are you talking about. There are APIs to send data.
    of course you are right.
    i just wanna use winsock.DLL Not OCX !
    my problem is exactly about how to using winsock.dll !!!
    how i should write my parameters to the URL and getting back the data as the result?

    my goal is sending this parameters:
    uname
    mail
    serial
    mobile
    by writing in the following URL i can send them:

    aheads.net/lotus/ajax.php?uname=ghasem&[email protected]&serial=12&mobile=111111

    and then i will have one data as the result in the winsock.ocx DataArrival procedure.
    my code was this:

    Code:
    Private Sub Command_send__Click()
        Dim strHTTP As String
        
        
    
        If blnConnected Then Exit Sub
        
        
        Dim S As String
        
        S = "uname=" & Trim(txt_name.Text)
        S = S & "&email=" & Trim(txt_email.Text)
        S = S & "&serial=" & Trim(txt_serial.Text)
        S = S & "&mobile=" & ""
        ' configure Winsock1
        Winsock1.Protocol = sckTCPProtocol
        Winsock1.RemoteHost = "aheads.net"
        Winsock1.RemotePort = 80
        
        
        'I have using GET Method
        strHTTP = "GET /lotus/sock.php?" & S & " HTTP/1.0" & vbCrLf
        strHTTP = strHTTP & "Host:aheads.net" & vbCrLf & vbCrLf
     
        Winsock1.Connect
        
        ' wait for a connection
        Do While Not blnConnected
            DoEvents
        Loop
        
        ' send the HTTP request
        Winsock1.SendData strHTTP
    End Sub    
    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
        Dim strResponse As String
    
        Winsock1.GetData strResponse, vbString, bytesTotal
        Dim k
        k = Split(strResponse, vbCrLf)
        
        txt_pass.Text = k(UBound(k))
    End Sub
    i need to remove winsock.ocx
    i must use winsock.dll

    I'm ready to learn.
    thanx

  6. #6
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: how to use winsock.DLL

    Here's a sample application using the DLL. I don't know if it even works or not but it does give you a good insight into using the DLL
    Attached Files Attached Files


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width