الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

ارجو المساعدة باسرع وقت

بدأه om-ali-ar في 9 فبراير 2009 · 0 رد · 341 مشاهدة · في لغة Ms Visual Basic 6 وما قبلها من إصدارات
مشاركة: واتساب X فيسبوك تيليجرام
#1

شغال مافي مشكلة ولكن يرسل كلام فقط كيف استطيع ان اجعله يرسلserver ,clientمتكونمنsocketمرحبا اخواني هذي اول مشاركة وارجو المساعدة باسرع وقت لدية برنامج يحتوي على ايبي ومسجpacket

كود السيرفر

Private Sub Form_Load()

' Set the LocalPort property to an integer.

' Then invoke the Listen method.

tcpserver.LocalPort = 1001

tcpserver.Listen

'frmClient.Show ' Show the client form.

End Sub

Private Sub tcpServer_ConnectionRequest _

(ByVal requestID As Long)

' Check if the control's State is closed. If not,

' close the connection before accepting the new

' connection.

If tcpserver.State <> sckClosed Then _

tcpserver.Close

' Accept the request with the requestID

' parameter.

tcpserver.Accept requestID

txtOutput.Text = "accept request from" + tcpserver.RemoteHostIP

End Sub

Private Sub txtSendData_Change()

' The TextBox control named txtSendData

' contains the data to be sent. Whenever the user

' types into the textbox, the string is sent

' using the SendData method.

tcpserver.SendData txtSendData.Text

End Sub

Private Sub tcpServer_DataArrival _

(ByVal bytesTotal As Long)

' Declare a variable for the incoming data.

' Invoke the GetData method and set the Text

' property of a TextBox named txtOutput to

' the data.

Dim strData As String

tcpserver.GetData strData

txtOutput.Text = strData

End Sub

Private Sub tsp_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)

End Sub

كود الكلاينت

Private Sub Form_Load()

' The name of the Winsock control is tcpClient.

' Note: to specify a remote host, you can use

' either the IP address (ex: "121.111.1.1") or

' the computer's "friendly" name, as shown here.

tcpClient.RemoteHost = "127.0.0.1"

tcpClient.RemotePort = 1001

End Sub

Private Sub cmdConnect_Click()

' Invoke the Connect method to initiate a

' connection.

tcpClient.Connect

End Sub

Private Sub txtSendData_Change()

tcpClient.SendData txtSendData.Text

End Sub

Private Sub tcpClient_DataArrival _

(ByVal bytesTotal As Long)

Dim strData As String

tcpClient.GetData strData

txtOutput.Text = strData

End Sub

Private Sub txtSend_Change()

End Sub

مواضيع مشابهة