Results 1 to 2 of 2

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

Threaded View

  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
    ***************

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