Click here to Skip to main content
15,910,471 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralArticle Pin
Gregory Gadow29-Mar-10 10:50
Gregory Gadow29-Mar-10 10:50 
QuestionTCP/IP with VB.Net Pin
gymgym_jim22-Mar-10 2:43
gymgym_jim22-Mar-10 2:43 
AnswerRe: TCP/IP with VB.Net Pin
Richard MacCutchan22-Mar-10 4:29
mveRichard MacCutchan22-Mar-10 4:29 
GeneralRe: TCP/IP with VB.Net Pin
gymgym_jim22-Mar-10 4:36
gymgym_jim22-Mar-10 4:36 
GeneralRe: TCP/IP with VB.Net Pin
Richard MacCutchan22-Mar-10 5:22
mveRichard MacCutchan22-Mar-10 5:22 
GeneralRe: TCP/IP with VB.Net Pin
gymgym_jim22-Mar-10 5:35
gymgym_jim22-Mar-10 5:35 
GeneralRe: TCP/IP with VB.Net Pin
Richard MacCutchan22-Mar-10 5:45
mveRichard MacCutchan22-Mar-10 5:45 
AnswerRe: TCP/IP with VB.Net Pin
Аslam Iqbal27-Mar-10 9:05
professionalАslam Iqbal27-Mar-10 9:05 
I try this and it works succesfully:

''Client
Imports System
Imports System.Net.Sockets
Imports System.Text

Public Class Form1
    Private Const portNum As Integer = 13
    Private Const hostName As String = "hostMachineName" ' or IP "192.168.131.67"

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            Dim client As New TcpClient(hostName, portNum)

            Dim ns As NetworkStream = client.GetStream()

            Dim bytes(1024) As Byte
            Dim bytesRead As Integer = ns.Read(bytes, 0, bytes.Length)
            Dim xx$
            xx = Encoding.ASCII.GetString(bytes, 0, bytesRead)
            Beep()
            'client.Connect
            client.Close()

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try


        'Return 0

    End Sub
End Class


'Host
Imports System
Imports System.Net.Sockets
Imports System.Text


Public Class Form1
    Private Const portNum As Integer = 13

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim done As Boolean = False

        Dim listener As New TcpListener(portNum)

        listener.Start()

        While Not done
            Console.Write("Waiting for connection...")
            Dim client As TcpClient = listener.AcceptTcpClient()

            Console.WriteLine("Connection accepted.")
            Dim ns As NetworkStream = client.GetStream()

            Dim byteTime As Byte() = _
                Encoding.ASCII.GetBytes(DateTime.Now.ToString())

            Try
                ns.Write(byteTime, 0, byteTime.Length)
                ns.Close()
                client.Close()
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End While

        listener.Stop()

    End Sub
End Class

QuestionDetecting end of HTTP Response Pin
AmitDey19-Mar-10 4:35
AmitDey19-Mar-10 4:35 
AnswerRe: Detecting end of HTTP Response Pin
Dave Kreskowiak19-Mar-10 5:01
mveDave Kreskowiak19-Mar-10 5:01 
GeneralRe: Detecting end of HTTP Response Pin
Ennis Ray Lynch, Jr.19-Mar-10 5:17
Ennis Ray Lynch, Jr.19-Mar-10 5:17 
GeneralRe: Detecting end of HTTP Response Pin
Dave Kreskowiak19-Mar-10 7:12
mveDave Kreskowiak19-Mar-10 7:12 
GeneralRe: Detecting end of HTTP Response Pin
AmitDey25-Apr-10 19:47
AmitDey25-Apr-10 19:47 
AnswerRe: Detecting end of HTTP Response Pin
T M Gray19-Mar-10 7:21
T M Gray19-Mar-10 7:21 
QuestionLicences Key For Windows/Web Application Pin
sreepavan15038518-Mar-10 2:54
sreepavan15038518-Mar-10 2:54 
AnswerRe: Licences Key For Windows/Web Application Pin
Not Active18-Mar-10 3:25
mentorNot Active18-Mar-10 3:25 
AnswerRe: Licences Key For Windows/Web Application Pin
annathor18-Mar-10 21:59
annathor18-Mar-10 21:59 
Questionforums Pin
deepali_h17-Mar-10 21:04
deepali_h17-Mar-10 21:04 
AnswerRe: forums Pin
deepali_h17-Mar-10 21:05
deepali_h17-Mar-10 21:05 
GeneralRe: forums Pin
Som Shekhar17-Mar-10 22:56
Som Shekhar17-Mar-10 22:56 
GeneralRe: forums Pin
JHizzle18-Mar-10 0:11
JHizzle18-Mar-10 0:11 
GeneralRe: forums Pin
Som Shekhar18-Mar-10 0:13
Som Shekhar18-Mar-10 0:13 
GeneralRe: forums Pin
JimmyRopes21-Mar-10 19:31
professionalJimmyRopes21-Mar-10 19:31 
GeneralRe: forums Pin
Som Shekhar21-Mar-10 19:35
Som Shekhar21-Mar-10 19:35 
GeneralRe: forums Pin
JimmyRopes21-Mar-10 19:37
professionalJimmyRopes21-Mar-10 19:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.