*/
Love this site? Hate it? Leave us some comments.
*/

View \frmServer.frm

WinDOS Shell 0.1A

Submitted By: Shehbaz
Rating: starstarstarstarstar (Rate It)


VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmServer
   BackColor       =   &H00000000&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Chat Server"
   ClientHeight    =   4890
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7665
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4890
   ScaleWidth      =   7665
   StartUpPosition =   2  'CenterScreen
   WindowState     =   1  'Minimized
   Begin MSComctlLib.StatusBar stsStatus
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      TabIndex        =   1
      Top             =   4515
      Width           =   7665
      _ExtentX        =   13520
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
         NumPanels       =   4
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
            Text            =   "Sessions : 0"
            TextSave        =   "Sessions : 0"
            Object.ToolTipText     =   "Number of Active Clients"
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
            AutoSize        =   1
            Bevel           =   0
            Object.Width           =   5768
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
            Style           =   6
            TextSave        =   "9/11/00"
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
            Style           =   5
            TextSave        =   "10:55 AM"
         EndProperty
      EndProperty
   End
   Begin VB.Timer tmrTimer
      Interval        =   1000
      Left            =   7140
      Top             =   705
   End
   Begin MSWinsockLib.Winsock wsk
      Index           =   0
      Left            =   7140
      Top             =   225
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin VB.ListBox lstMessages
      BackColor       =   &H00000000&
      ForeColor       =   &H0000FF00&
      Height          =   2205
      Left            =   105
      TabIndex        =   0
      Top             =   240
      Width           =   2880
   End
End
Attribute VB_Name = "frmServer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Const MAX_SESSIONS = 13
Private Const WSK_LOCAL_PORT = 12345

Private Sub UpdateStatus()
Dim i As Integer
Dim actsess As Integer
For i = 1 To MAX_SESSIONS
    With wsk(i)
        If .State = sckConnected Then
            actsess = actsess + 1
        End If
    End With
Next
With stsStatus
    .Panels(1).Text = "Sessions : " & Trim$(Str$(actsess))
End With
End Sub
Private Sub Form_Load()
Dim i As Integer
With wsk(0)
    .Protocol = sckTCPProtocol
    .LocalPort = WSK_LOCAL_PORT
    .Listen
End With
For i = 1 To MAX_SESSIONS
    Load wsk(i)
    wsk(i).Protocol = sckTCPProtocol
    wsk(i).LocalPort = WSK_LOCAL_PORT
Next
UpdateStatus
End Sub

Private Sub tmrTimer_Timer()
UpdateStatus
End Sub

Private Sub wsk_Close(Index As Integer)
UpdateStatus
End Sub

Private Sub wsk_Connect(Index As Integer)
UpdateStatus
End Sub

Private Sub wsk_ConnectionRequest(Index As Integer, ByVal requestID As Long)
Dim msg As String
Dim i As Integer
If Index = 0 Then
For i = 1 To MAX_SESSIONS
    With wsk(i)
        If .State = sckClosed Then
            .Accept requestID
            Exit For
        End If
    End With
Next
End If
End Sub

Private Sub wsk_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim msg As String
Dim rc As Integer
Dim i As Integer
wsk(Index).GetData msg, , bytesTotal
lstMessages.AddItem msg
For i = 1 To MAX_SESSIONS
    With wsk(i)
        If .State = sckConnected Then
            .SendData msg
            DoEvents
        End If
    End With
Next
End Sub

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.