Brauche Hilfe [MultiServer (TCP)]

  • VB.NET

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von gfcwfzkm.

    Brauche Hilfe [MultiServer (TCP)]

    Hallo liebes VBParadise Team und Gemeindschaft,

    ich suche vergebens nach einer Lösung.

    Zu meinem Problem:

    Der MultiServer und die Userlist funktioniert einwandfrei.
    Nun habe ich aber eine kleine Idee, ich möchte zu einem User eine Privat Nachricht schreiben. Sobald er Online kommt soll oben Rechts im Client stehen 1 Neue Nachricht z.B die kann er dann lesen und beantworten.

    Wie mache ich das? Bitte um eure Hilfe.


    MfG
    Kekzline
    Also, das es oben anzeigt, das er eine neue nachricht hat, hab ich nicht, aber er bekommt eine nachricht, die er immer lesen kann...

    Ich gib dir mal den code, hab ihn in 2 Formen für Senden und 2 Für den Nachrichten-eingang. ;)

    also, hier der code von der ersten Form für's senden:

    VB.NET-Quellcode

    1. Public Class Whisper
    2. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    3. Me.Close()
    4. Form1.Show()
    5. End Sub
    6. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    7. If Form1.TextBox5.Text = TextBox2.Text And TextBox3.Text = Form2.TextBox3.Text Then
    8. whispername = TextBox1.Text
    9. Form4.Show()
    10. Me.Close()
    11. username = Form2.TextBox3.Text
    12. Else
    13. MsgBox("Falsches Passwort oder Username!", MsgBoxStyle.Exclamation)
    14. End If
    15. End Sub
    16. End Class

    den code habe ich meinem FTP-Chat "entrissen" aber kannst ihn ja dann anpassen...
    Hier der eigentliche sender-code:

    VB.NET-Quellcode

    1. Public Class Form4
    2. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    3. Me.Close()
    4. Form1.Show()
    5. End Sub
    6. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    7. Dim client As New Net.WebClient
    8. client.Credentials = New Net.NetworkCredential("FTPanmeldename", "FTP-PW")
    9. Try
    10. client.UploadString("ftp://deineftpsite/" + whispername + ".txt", client.DownloadString("ftp://deineftp/" + whispername + ".txt") + "Time: " + TimeOfDay + " Username: " + username + ": " + TextBox1.Text + Environment.NewLine)
    11. Catch
    12. client.UploadString("ftp://deinFTPsite/" + whispername + ".txt", "")
    13. client.UploadString("ftp://deine ftp/" + whispername + ".txt", client.DownloadString("ftp://deine ftp/" + whispername + ".txt") + "Time: " + TimeOfDay + " Username: " + username + ": " + TextBox1.Text + Environment.NewLine)
    14. End Try
    15. End Sub
    16. End Class


    jetzt noch die 2 empfängerformen, hier die erste:

    VB.NET-Quellcode

    1. Public Class Form5
    2. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    3. Me.Close()
    4. Form1.Show()
    5. End Sub
    6. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    7. usernamelook = TextBox1.Text
    8. Me.Close()
    9. Form6.Show()
    10. End Sub
    11. End Class


    und nun des lesen:

    VB.NET-Quellcode

    1. Public Class Form6
    2. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    3. Me.Close()
    4. Form1.Show()
    5. End Sub
    6. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    7. Try
    8. Dim client As New Net.WebClient
    9. client.Credentials = New Net.NetworkCredential("ftpname", "ftppw")
    10. RichTextBox1.Text = client.DownloadString("ftp://deineftp/Chat/Fl%C3%BCstern/" & usernamelook & ".txt")
    11. Catch
    12. End Try
    13. End Sub
    14. Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    15. Try
    16. Dim client As New Net.WebClient
    17. client.Credentials = New Net.NetworkCredential("ftpname", "ftp-pw")
    18. RichTextBox1.Text = client.DownloadString("ftp://deineftp/Chat/Fl%C3%BCstern/" & usernamelook & ".txt")
    19. Catch
    20. End Try
    21. End Sub
    22. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    23. Whisper.Show()
    24. Me.Close()
    25. End Sub
    26. End Class


    Ach, für userlook habe ich unter module noch was gemacht...
    tja, ich glob, ich konnte dir helfen :thumbsup: