Results 1 to 2 of 2

Thread: Check this code out... Its winsock...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2001
    Location
    www.alexdata.com
    Posts
    484

    Check this code out... Its winsock...

    Why wont this code let me SEND some data back...

    Where would I put some winsock.senddata that can actually send some data back after recieving some...

    I have this..both as code and as ZIP file..
    '----------------------------------------------------

    Private Sub Command1_Click()
    DoEvents
    Winsock1.Close
    Winsock1.LocalPort = 80
    Winsock1.Listen
    End Sub

    Private Sub Command2_Click()
    Dim wsh
    Set wsh = CreateObject("WScript.Shell")
    wsh.run ("iexplore.exe http://127.0.0.1")
    End Sub

    Private Sub Form_Load()
    Winsock1.Close
    Winsock1.LocalPort = 80
    Winsock1.Listen
    End Sub

    '************************************
    '*********Connect - Recieve *********

    Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
    Winsock1.Close
    Winsock1.Accept requestID

    If Winsock1.State = sckconnect Then
    MsgBox "It IS connected in ConnectionRequest", vbSystemModal, "#"
    Winsock1.SendData "<body><h1><center>ConReq OK..</center></h1></body>"
    ElseWinsock1.SendData "<body><h1><center>ConReq OK..</center></h1></body>"

    MsgBox "Its NOT connected in ConnectionRequest", vbSystemModal, "!"
    End If

    End Sub

    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    Dim data As String
    Winsock1.GetData data
    MsgBox data, vbSystemModal, "Data Recieved:"

    If Winsock1.State = sckconnect Then
    MsgBox "It is connected in DataArrival", vbSystemModal, "#"
    Winsock1.SendData "<body><h1><center>ConReq OK..</center></h1></body>"
    Else
    MsgBox "Its NOT connected in DataArrival", vbSystemModal, "!"
    End If

    Winsock1.Close
    End Sub

    '----------------------------------------------
    Attached Files Attached Files
    ***************
    Please use [highlight=vb] ..your code.. [/highlight] when posting code!

    When you have received the working answer to your question,
    please mark it as *SOLVED* + Your Questions Title ...using your Thread's Tool menu.


    Also try to point out what answer made it work for you, or edit your first post to contain a quote of the correct answer...

    Please Answer All Questions With Working Code Examples...


    My Unfinished Projects and My working Programs
    ***************

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2001
    Location
    www.alexdata.com
    Posts
    484

    Thumbs up I solved it MYSELF... Man how much work!

    So below i post a working code ,but with minor bugs in it...

    Like you must DoubleClick a link, and press update in explorer inorder to recieve and send back data to explorer...

    But if you fix the part that reads the GET from explorer then
    it will be easy to fix this... Hehe
    Attached Files Attached Files
    ***************
    Please use [highlight=vb] ..your code.. [/highlight] when posting code!

    When you have received the working answer to your question,
    please mark it as *SOLVED* + Your Questions Title ...using your Thread's Tool menu.


    Also try to point out what answer made it work for you, or edit your first post to contain a quote of the correct answer...

    Please Answer All Questions With Working Code Examples...


    My Unfinished Projects and My working Programs
    ***************

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