Jump to content
Sign in to follow this  

Communicating TCP

Recommended Posts

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

Client : 

TCPStartup ()
$TCPConnect = TCPConnect ("", 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)

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)

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

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

TCPSend ($TCPAccept, "Hi client")





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

Share this post

Link to post
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
Sign in to follow this  

  • Create New...