NetClient

class NetClient()
AutoReceive();()
net.AutoReceive( ip, 11077, "UTF-16LE" );
Connect(host, port)
net.Connect('http://google.com', 80);
Disconnect()
GetBroadcastAddress()
IsEnabled()
IsConnected()
ReceiveDatagram(encoding, port, timeout);()
net.ReceiveDatagram( "UTF-16LE", 11088, 300 );
net.ReceiveDatagram( "UTF-8", port, 1 );
ReceiveBytes(type)
bytes = net.ReceiveBytes('Hex');
bytes = net.ReceiveBytes('Int');
ReceiveText(encode)

Ожидает данные, для больших объекиов данных может потребоваться повторный вызов функции

msg = net.ReceiveText('UTF-8')
SendBytes(bytes)
net.SendBytes('47,45,54,20,2F,20,48,54,54,50,2F,31,2E,31,0D,0A,0D,0A', 'Hex');
net.SendBytes([0x47,0x45,0x54,0x20,0x2F,0x20,0x48,0x54,0x54,0x50,0x2F,0x31,0x2E,0x31,0x0D,0x0A,0x0D,0x0A], "Int" );
SendDatagram();()
net.SendDatagram("wdemo:hello", "UTF-16LE", GetBroadcastAddress(), 11088);
SendText(text, mode)
  • mode

    • US-ASCII
    • UTF-16LE
    • UTF-16BE
    • UTF-16
    • UTF-8
net.SendText('123', "UTF-16LE");
SetOnConnect(callback)
net.SetOnConnect(function(connected){});
SetOnReceive(callback)
net.SetOnReceive(function(text){});

NetClient.AutoReceive( server,port,mode ) NetClient.Connect( address,port ) NetClient.Disconnect() NetClient.DownloadFile( file ) NetClient.GetBroadcastAddress() NetClient.IsConnected() NetClient.IsEnabled() NetClient.ReceiveDatagram( encoding, port, timeout ) NetClient.ReceiveFile( file,wait ) NetClient.ReceiveText( mode ) NetClient.SendDatagram( packet, encoding, address, port ) NetClient.SendText( text,mode ) NetClient.SetOnConnect( callback ) NetClient.SetOnDownload( callback ) NetClient.SetOnReceive( callback ) NetClient.SetTimeout( callback )