Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > .NET Framework > Forum > chat มีปัญหาทางการส่งข้อความในวงเเลนครับ ช่วยหน่อยครับท่านเทพ



 

chat มีปัญหาทางการส่งข้อความในวงเเลนครับ ช่วยหน่อยครับท่านเทพ

 



Topic : 037155



โพสกระทู้ ( 27 )
บทความ ( 0 )



สถานะออฟไลน์




ปัญหาคือ ส่งไปไอพี่อื่นไม่ได้ครับพอใส่ไอพีเครื่องๆข้างๆ จะขึ้นแบบนี้ครับ
ไม่ผ่านที

ถ้าไงรบกวนดูโค๊ดครับ บอกผมทีครับว่ามีปัญหาอะไร เเล้วแก้ยังไงครับผมงงมากเลย ผมทำไปเยอะเเล้วเเต่มีปัญหาในกานส่งครับCode (VB.NET)
Imports Microsoft.VisualBasic

Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Text
Imports System.IO.FileNotFoundException
Imports System.IO.Stream



Imports System.Windows.Forms


Public Class Form2
    Inherits System.Windows.Forms.Form

    Public Sub New()
        MyBase.New()

        InitializeComponent()
    End Sub

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    Private components As System.ComponentModel.IContainer
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.TextBox2 = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.TextBox3 = New System.Windows.Forms.TextBox
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
        Me.TextBox4 = New System.Windows.Forms.TextBox
        Me.TextBox5 = New System.Windows.Forms.TextBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.TextBox6 = New System.Windows.Forms.TextBox
        Me.Button3 = New System.Windows.Forms.Button
        Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog
        Me.PictureBox1 = New System.Windows.Forms.PictureBox
        CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(98, 73)
        Me.TextBox1.Multiline = True
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(330, 78)
        Me.TextBox1.TabIndex = 0
        Me.TextBox1.Text = " "
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(12, 76)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(48, 24)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "ข้อความ"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(12, 43)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(80, 24)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "เรียกใช้ IP"
        '
        'TextBox2
        '
        Me.TextBox2.Location = New System.Drawing.Point(98, 43)
        Me.TextBox2.Name = "TextBox2"
        Me.TextBox2.Size = New System.Drawing.Size(136, 20)
        Me.TextBox2.TabIndex = 3
        Me.TextBox2.Text = "192.168.200.251"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(3, 233)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(89, 24)
        Me.Label3.TabIndex = 4
        Me.Label3.Text = "ข้อความสนทนา"
        '
        'TextBox3
        '
        Me.TextBox3.Location = New System.Drawing.Point(98, 258)
        Me.TextBox3.Multiline = True
        Me.TextBox3.Name = "TextBox3"
        Me.TextBox3.Size = New System.Drawing.Size(330, 124)
        Me.TextBox3.TabIndex = 5
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(434, 197)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(70, 24)
        Me.Button1.TabIndex = 6
        Me.Button1.Text = "ส่ง"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(434, 160)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(70, 24)
        Me.Button2.TabIndex = 6
        Me.Button2.Text = "เลือกไฟล์"
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        '
        'TextBox4
        '
        Me.TextBox4.Location = New System.Drawing.Point(98, 160)
        Me.TextBox4.Multiline = True
        Me.TextBox4.Name = "TextBox4"
        Me.TextBox4.Size = New System.Drawing.Size(330, 24)
        Me.TextBox4.TabIndex = 7
        '
        'TextBox5
        '
        Me.TextBox5.Location = New System.Drawing.Point(98, 17)
        Me.TextBox5.Name = "TextBox5"
        Me.TextBox5.Size = New System.Drawing.Size(136, 20)
        Me.TextBox5.TabIndex = 8
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(12, 13)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(80, 24)
        Me.Label4.TabIndex = 9
        Me.Label4.Text = "ชื่อผู้ส่ง"
        '
        'TextBox6
        '
        Me.TextBox6.Location = New System.Drawing.Point(98, 388)
        Me.TextBox6.Multiline = True
        Me.TextBox6.Name = "TextBox6"
        Me.TextBox6.Size = New System.Drawing.Size(330, 24)
        Me.TextBox6.TabIndex = 10
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(434, 388)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(70, 24)
        Me.Button3.TabIndex = 11
        Me.Button3.Text = "บันทึกไฟล์"
        '
        'SaveFileDialog1
        '
        '
        'PictureBox1
        '
        Me.PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.PictureBox1.Image = Global.WindowsApplication1.My.Resources.Resources.Clip_2
        Me.PictureBox1.Location = New System.Drawing.Point(434, 3)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(121, 119)
        Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
        Me.PictureBox1.TabIndex = 12
        Me.PictureBox1.TabStop = False
        '
        'Form2
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(567, 495)
        Me.Controls.Add(Me.PictureBox1)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.TextBox6)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.TextBox5)
        Me.Controls.Add(Me.TextBox4)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.TextBox3)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.TextBox1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
        Me.Name = "Form2"
        CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim bytes(200) As Byte
        Dim MyIP As IPAddress
        Dim RemoteIP As IPAddress
        Dim str As String

        RemoteIP = IPAddress.Parse(TextBox2.Text)
        MyIP = IPAddress.Parse("192.168.200.251")

        Dim Port1 As Integer = 8080
        Dim port2 As Integer = 8081

        Dim myLocal As New IPEndPoint(MyIP, Port1)
        Dim myRemote As New IPEndPoint(RemoteIP, port2)
        Dim receive1 As New UdpClient(myRemote)
        Dim send1 As New UdpClient(myLocal)

        Try
            bytes = System.Text.Encoding.UTF8.GetBytes(TextBox1.Text.ToUpper)
            send1.Send(bytes, bytes.Length, myRemote)
            str = System.Text.Encoding.UTF8.GetString(bytes)
            TextBox3.Text = TextBox3.Text & vbCrLf & str

            bytes = receive1.Receive(myLocal)
            str = System.Text.Encoding.UTF8.GetString(bytes)
            TextBox3.Text = TextBox2.Text & " : " & TextBox5.Text & vbCrLf & str
            TextBox6.Text = TextBox4.Text

        Catch ex As Exception
            Console.WriteLine("")
        End Try
        send1.Close()
        receive1.Close()
    End Sub


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        OpenFileDialog1.Filter = " All files (*.*)|*.*"
        If OpenFileDialog1.ShowDialog = DialogResult.OK Then
            TextBox4.Text = OpenFileDialog1.FileName


        End If




    End Sub
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

    Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged

    End Sub
    Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
    Friend WithEvents Label4 As System.Windows.Forms.Label

    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

    End Sub
    Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents SaveFileDialog1 As System.Windows.Forms.SaveFileDialog
    Private WithEvents PictureBox1 As System.Windows.Forms.PictureBox

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

    End Sub

    Private Sub PictureBox1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDoubleClick
        OpenFileDialog1.Filter = " All files (*.*)|*.*"
        If OpenFileDialog1.ShowDialog = DialogResult.OK Then
            PictureBox1.ImageLocation = OpenFileDialog1.FileName


        End If
    End Sub

    Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs)

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        SaveFileDialog1.Filter = " All files (*.*)|*.*"
        If SaveFileDialog1.ShowDialog = DialogResult.OK Then
            TextBox6.Text = SaveFileDialog1.FileName


        End If

    End Sub

    Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
       
    End Sub
End Class




Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-01-16 18:43:41 By : apiluk415 View : 1366 Reply : 3
 

 

No. 1



โพสกระทู้ ( 538 )
บทความ ( 3 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


ลองดูเรื่อง firewall ดูยังครับ ปิด หรือ config เพิ่มยัง

แล้วตรงนี้ครับ เพิ่มตามข้างล่างเข้าไปครับ จะได้รู้ error เพิ่มขึ้น และตรงจุดมากขึ้นครับ

Try
    bytes = System.Text.Encoding.UTF8.GetBytes(TextBox1.Text.ToUpper) 
    send1.Send(bytes, bytes.Length, myRemote) 
    str = System.Text.Encoding.UTF8.GetString(bytes) 
    TextBox3.Text = TextBox3.Text & vbCrLf & str 
 
    bytes = receive1.Receive(myLocal) 
    str = System.Text.Encoding.UTF8.GetString(bytes) 
    TextBox3.Text = TextBox2.Text & " : " & TextBox5.Text & vbCrLf & str 
    TextBox6.Text = TextBox4.Text 
 
Catch ex As Exception 
    Console.WriteLine("") 
Catch exSocket As SocketException 
    Console.WriteLine("") 
End Try







Date : 2010-01-16 21:56:34 By : salapao_codeman
 


 

No. 2



โพสกระทู้ ( 3,144 )
บทความ ( 1 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


เอาโปรเจ็คนี้ไปลองดู http://www.codeproject.com/KB/menus/MyLanApp.aspx
Date : 2010-01-17 08:50:05 By : tungman
 

 

No. 3



โพสกระทู้ ( 27 )
บทความ ( 0 )



สถานะออฟไลน์


ขอบคุณนะครับ ที่บอกครับ เเต่ ลองเเล้วมิๆด้เลยครับ ส่วนที่เเนะนำเว็ปโปรเจ๊กใหม่รันได้เเต่ ส่งมิได้เหมือนเหมือนกันครับ เเย่เเล้ว ส่งโปรเจ๊ครายวิชาไม่ได้ ส่งวันจันนี้เเล้ว เเงๆๆจะทันไหมน่า
Date : 2010-01-17 15:55:38 By : apiluk415
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : chat มีปัญหาทางการส่งข้อความในวงเเลนครับ ช่วยหน่อยครับท่านเทพ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่