Jump to content

REQUEST and RESPONSE json via TCP/IP connection.


Recommended Posts

I want send a REQUEST  and RESPONSE via TCP/IP connections. Here my code but it not work. please help me. Thank for all.

 

Global $MainSocket
Local $MaxLength = 1512; Maximum Length Of Text
Local $Port = 3333; Port Number
Local $Server = '192.168.1.59'; Server IpAddress
TCPStartup()
$MainSocket = TCPConnect($Server, $Port)
If $MainSocket = -1 Then Exit MsgBox(16, "Error", "Unable to connect.")
 Local $Data1 ='{"id":0,"jsonrpc":"2.0","method":"miner_getstat1"}'

   TCPSend($MainSocket, "miner_restart")
    TCPCloseSocket($MainSocket)
    $Data = TCPRecv($MainSocket, $MaxLength)

        MsgBox(0, "Received Packet", $Data)

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