Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 18011
Number of posts: 55384

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Chat Program Posted by JTB600A on 2 May 2011 at 12:57 PM
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!
Report
Re: Chat Program Posted by Nase on 19 Aug 2011 at 5:43 AM
This is an example

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


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

Report
This post has been deleted. Posted by Nase on 19 Aug 2011 at 5:53 AM
This post has been deleted.
Report
This post has been deleted. Posted by Nase on 19 Aug 2011 at 6:39 AM
This post has been deleted.
Report
This post has been deleted. Posted by Nase on 19 Aug 2011 at 6:45 AM
This post has been deleted.
Report
This post has been deleted. Posted by Nase on 19 Aug 2011 at 6:48 AM
This post has been deleted.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.