Devv Active Member Licensed User Longtime User Oct 27, 2014 #1 How could i send a simple string over tcp to a local tcp server ? i had made this simple tcp server script using Autoit B4X: TCPStartup() $listen = TCPListen(@IPAddress1,403) Do $accept = TCPAccept($listen) Until $accept <> -1 Do $recive = TCPRecv($accept,10000000) Until $recive <> "" MsgBox(0,0,$recive) this will show the first string that will be received by my PC on port 403 how can i send the string "hi" using b4a to port "403" and ip "192.168.1.111" ? any ideas how to do it as simple as possible ?
How could i send a simple string over tcp to a local tcp server ? i had made this simple tcp server script using Autoit B4X: TCPStartup() $listen = TCPListen(@IPAddress1,403) Do $accept = TCPAccept($listen) Until $accept <> -1 Do $recive = TCPRecv($accept,10000000) Until $recive <> "" MsgBox(0,0,$recive) this will show the first string that will be received by my PC on port 403 how can i send the string "hi" using b4a to port "403" and ip "192.168.1.111" ? any ideas how to do it as simple as possible ?
Fusseldieb Active Member Licensed User Longtime User Oct 27, 2014 #2 Look here: http://www.b4x.com/android/forum/threads/tcp-socket-and-outputstream.34531/#content Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Oct 28, 2014 #3 Don't use TextWriter / TextReader with network streams. Instead use AsyncStreams. Upvote 0
Devv Active Member Licensed User Longtime User Oct 28, 2014 #4 Mr Erel may you explain the difference ? for me i think text writer is easier right ? i only want to send small strings to local tcp server Upvote 0
Mr Erel may you explain the difference ? for me i think text writer is easier right ? i only want to send small strings to local tcp server
Erel B4X founder Staff member Licensed User Longtime User Oct 28, 2014 #5 TextReader and TextWriter will block the main thread. TextReader is especially dangerous as it can easily hang the complete app (with a network stream). AsyncStreams is explained here: http://www.b4x.com/android/forum/threads/7669/#content Upvote 0
TextReader and TextWriter will block the main thread. TextReader is especially dangerous as it can easily hang the complete app (with a network stream). AsyncStreams is explained here: http://www.b4x.com/android/forum/threads/7669/#content