How to Load Flash Stream Sockets in VB.NET
- 1). Click "Start," "All Program" and "Visual Studio." Click "File" and "New Project" to create a new project. Select "Visual Basic" as the program language and "Windows Application" as the application type. Enter a name for the project. Select a location for the project.
- 2). Click "Form1" under the new project on the left navigation panel. Click "Toolbar" and then select "Button." Click the blank area of "Form1" and drop the button. On the properties section, enter a name and description for the button.
- 3). Double-click the button to enter the programming window. Define variables as follows:
Dim tcpclient AS New TcpClient
Dim networkstream AS NetworkStream
Connect to the server computer:
tcpclient.Connect("127.0.1.5") - 4). The server sends information to the client: "text" contains data which is written to "networkstream" while the network reads information from "networkstream" to "mybuffer".
Dim text AS Byte=Encoding.ASCII.GetBytes("123aad")
networkstream=tcpclient.GetStream()
networkstream.Write(text,0, text.length)
Dim buffersize AS Integer= tcpclient.ReceiveBufferSize
Dim mybuffer (buffersize) AS Byte
networkstream.Read (mybuffer, 0, buffersize)
Console.Writeline (Encoding.ASCII.GetString (mybuffer, 0, buffersize))
Source...