Chat Program - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Chat Program

JTB600AJTB600A Posts: 4Member
I am trying to write a Chat Program that will work across my school's LAN, It is for my final Project, I need to know how to get to the network with Visual Basic. Any help would be amazing.
THANKS!

Comments

  • NaseNase Posts: 10Member
    This is an example

    [code]Imports System.Net.Sockets
    Imports System.Net
    Imports System.Threading
    Imports System.Text

    Public Class Tester

    Public Shared Sub Main
    Dim myTcpClient As New TcpClient()
    Dim myNetworkStream As NetworkStream

    Try
    myTcpClient.Connect("127.0.0.1", 12345)
    myNetworkStream = myTcpClient.GetStream()
    Catch ex As ArgumentOutOfRangeException
    Console.WriteLine(ex.Message)
    Catch ex As SocketException
    Console.WriteLine(ex.Message)
    End Try

    Dim myBytes() As Byte = Encoding.ASCII.GetBytes("asdf")

    myNetworkStream = myTcpClient.GetStream()
    myNetworkStream.Write(myBytes, 0, myBytes.Length)

    Dim bufferSize As Integer = myTcpClient.ReceiveBufferSize
    Dim myBufferBytes(bufferSize) As Byte

    myNetworkStream.Read(myBufferBytes, 0, bufferSize)
    Console.WriteLine(Encoding.ASCII.GetString(myBufferBytes, 0, bufferSize))
    End Sub
    End Class[/code]

    Details also at:
    [link=http://msdn.microsoft.com/en-us/library/system.net.sockets.aspx]http://msdn.microsoft.com/en-us/library/system.net.sockets.aspx[/link]

  • NaseNase Posts: 10Member
    This post has been deleted.
  • NaseNase Posts: 10Member
    This post has been deleted.
  • NaseNase Posts: 10Member
    This post has been deleted.
  • NaseNase Posts: 10Member
    This post has been deleted.
Sign In or Register to comment.