Jump to content
xisto Community

warlordluke

Members
  • Content Count

    1
  • Joined

  • Last visited

Everything posted by warlordluke

  1. good lyrics mate i do alot of writing myself and thats mostly the way i write them. Basing them around an emotion or an event
  2. Hi all This is how you make a basic Client/Server Chat (Server Side) For this code you require - 2 Textboxes (You can call them anything you want but i'm going to call them txthst (Chat history) txtmsg (Chat Message)) - 1 Command Button (You can call it what ever you want but i'm going call it cmdsnd (To Send Messages)) - 1 Winsock Control (You can call it what ever you want but i'm going to call it ws (To listen)) MainFrm.frm Menu - Exit Private Sub Form_Load() ws.LocalPort = 12345 ws.ListenEnd SubPrivate Sub Winsock_ConnectionRequest(ByVal RequestID As Long) ws.Close ws.Accept RequestIDEnd SubPrivate Sub Winsock_DataArrival(ByVal bytesTotal As Long)Dim strData As String ws.GetData strData txthst.Text = txthst.Text & vbCrLf & strData txthst.SelStart = Len(txthst.Text)End SubPrivate Sub cmdsnd_Click() Winsock.SendData txtChat.Text DoEvents txthst.Text = txthst.Text & vbCrLf & txtmsg.Text txtmsg.Text = ""End Sub (Client Side) For this code you require - 2 Textboxes (You can call them anything you want but i'm going to call them txthst (Chat history) txtmsg (Chat Message)) - 1 Command Button (You can call it what ever you want but i'm going call it cmdsnd (To Send Messages)) - 1 Winsock Control (You can call it what ever you want but i'm going to call it ws (To Connect to the server)) Private Sub Form_Load() ws.RemoteHost = "127.0.0.1" ws.RemotePort = 12345 ws.ConnectEnd SubPrivate Sub cmdSend_Click() ws.SendData txtmsg.Text DoEvents txthst.Text = txthst.Text & vbCrLf & txtmsg.Text txtmsg.Text = ""End SubPrivate Sub Winsock_Connect() MsgBox "Connected"End SubPrivate Sub Winsock_DataArrival(ByVal bytesTotal As Long)Dim strData As String ws.GetData strData txthst.Text = txtmsg.Text & vbCrLf & strData txthst.SelStart = Len(txthst.Text)End SubPrivate Sub Winsock_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) MsgBox "Error: " & DescriptionEnd Sub There you go people and entier tutorial on a basic person to person chat system using winsock and you can expand on this in many different ways. Example adding images to show the different states of the winsock control. (I may show this later)
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.