פתיחת פורטים.

Biggiea

New member
פתיחת פורטים.

אהלן, מצאתי בעזרה של .net דוגמא לצ'אט פשוט, העברת מידע בין שני מחשבים. ניסיתי לשנות אותה כך שאני אוכל לשלוח מידע מתוכנה אחרת דרך הפורט שנפתח בעזרת /net ? מקווה שתצליחו לעזור לי, תודה.
 

Biggiea

New member
הנה הדוגמא

Const portNumber As Integer = 13 Dim tcpListener As New TcpListener(portNumber) tcpListener.Start() Console.WriteLine("Waiting for a connection....") Try 'Accept the pending client connection and return a TcpClient initialized for communication. Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient() Console.WriteLine("Connection accepted.") Dim networkStream As NetworkStream = tcpClient.GetStream() Dim responseString As String = "You have successfully connected to me." Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(responseString) networkStream.Write(sendBytes, 0, sendBytes.Length) Console.WriteLine(("Message Sent /> : " + responseString)) 'Any communication with the remote client using the TcpClient can go here. ' '////// 'Close TcpListener and TcpClient. tcpClient.Close() tcpListener.Stop() Catch e As Exception Console.WriteLine(e.ToString()) End Try​
כשאני מנסה להעביר מידע ה VB לא נותן לתוכנה האחרת לקבל אותה, אלא משתמש במידע בעצמו... רעיונות?
 
למעלה