Jump to content

Communicating TCP


Recommended Posts

So, for personal reasons, I want to communicate between my Virtual Machine and the Host pc.

Client : 

TCPStartup ()
$TCPConnect = TCPConnect ("127.0.0.1", 8080)
If $TCPConnect = -1 Then Exit
TCPSend($TCPConnect, "Hi server how are you")
While 1
    $TCPRec = TCPRecv ($TCPConnect, 1000000)
    If $TCPRec <> "" Then
        MsgBox (0, "Server sended me response", $TCPRec,9)
  
WEnd

Server : 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Server", 524, 101, 207, 133)
$Input1 = GUICtrlCreateInput("Input1", 8, 8, 505, 21)
$Button1 = GUICtrlCreateButton("Send", 8, 40, 505, 57)
GUISetState(@SW_SHOW)

TCPStartup()
$TCPListen = TCPListen ("127.0.0.1", 8080, 100)


While 1
   $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            Case $Button1
Do
    $TCPAccept = TCPAccept($TCPListen)
Until $TCPAccept <> -1


TCPSend ($TCPAccept, "Hi client")

    EndSwitch
Wend

 

 

 

But it doesn't work, I used Hamachi and it still didn't work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...