home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{FFACF7F3-B868-11CE-84A8-08005A9B23BD}#1.7#0"; "DSSOCK32.OCX"
- Begin VB.Form server
- BorderStyle = 3 'Fixed Dialog
- Caption = "server"
- ClientHeight = 2925
- ClientLeft = 5190
- ClientTop = 1515
- ClientWidth = 3870
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 2925
- ScaleWidth = 3870
- ShowInTaskbar = 0 'False
- Begin VB.TextBox txtHandle
- Height = 285
- Left = 1200
- TabIndex = 7
- Text = "handle"
- Top = 3000
- Width = 1695
- End
- Begin VB.CommandButton Command1
- Caption = "serve"
- Height = 255
- Left = 1200
- TabIndex = 6
- Top = 2640
- Width = 855
- End
- Begin VB.CommandButton Command2
- Caption = "exit"
- Height = 255
- Left = 2040
- TabIndex = 5
- Top = 2640
- Width = 855
- End
- Begin VB.TextBox Text3
- Height = 285
- Left = 3360
- TabIndex = 4
- Text = "1337"
- Top = 2280
- Width = 495
- End
- Begin VB.TextBox Text2
- Height = 285
- Left = 0
- TabIndex = 3
- Text = "text to say"
- Top = 2280
- Width = 3255
- End
- Begin VB.TextBox Text1
- Height = 2175
- Left = 0
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 2
- Top = 0
- Width = 3855
- End
- Begin dsSocketLib.dsSocket dsSocket2
- Height = 420
- Left = 360
- TabIndex = 1
- Top = 2640
- Width = 420
- _Version = 65543
- _ExtentX = 741
- _ExtentY = 741
- _StockProps = 64
- LocalPort = 1337
- RemoteHost = ""
- RemotePort = 0
- ServiceName = ""
- RemoteDotAddr = ""
- Linger = -1 'True
- Timeout = 10
- LineMode = 0 'False
- EOLChar = 10
- BindConnect = 0 'False
- SocketType = 0
- End
- Begin dsSocketLib.dsSocket dsSocket1
- Height = 420
- Left = 0
- TabIndex = 0
- Top = 2640
- Width = 420
- _Version = 65543
- _ExtentX = 741
- _ExtentY = 741
- _StockProps = 64
- LocalPort = 1337
- RemoteHost = ""
- RemotePort = 0
- ServiceName = ""
- RemoteDotAddr = ""
- Linger = -1 'True
- Timeout = 10
- LineMode = 0 'False
- EOLChar = 10
- BindConnect = 0 'False
- SocketType = 0
- End
- Attribute VB_Name = "server"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- On Error Resume Next
- If Command1.Caption = "serve" Then
- Command1.Caption = "stop"
- Text1 = " *** waiting for a connection" & vbCrLf
- dsSocket1.RemoteDotAddr = "0.0.0.0"
- dsSocket1.LocalDotAddr = "0.0.0.0"
- dsSocket1.RemotePort = Text3
- dsSocket1.Listen
- Text1 = Text1 & " *** stopped serving" & vbCrLf
- Command1.Caption = "serve"
- dsSocket1.Close
- dsSocket2.Close
- End If
- End Sub
- Private Sub Command2_Click()
- On Error Resume Next
- dsSocket1.Close
- dsSocket2.Close
- client.dsSocket1.Close
- Unload Me
- Unload server
- End Sub
- Private Sub dsSocket1_Accept(SocketID As Integer)
- On Error Resume Next
- dsSocket2.Socket = SocketID 'accepts connection
- Text1 = Text1 & " *** serving chat" & vbCrLf
- dsSocket1.Close 'closes the listening socket.
- End Sub
- Private Sub dsSocket1_Exception(ErrorCode As Integer, ErrorDesc As String)
- On Error Resume Next
- dsSocket1.Close
- dsSocket2.Close
- End Sub
- Private Sub dsSocket2_Close(ErrorCode As Integer, ErrorDesc As String)
- On Error Resume Next
- Command1.Caption = "serve"
- Text1 = Text1 & " *** client disconnected" & vbCrLf
- End Sub
- Private Sub dsSocket2_Exception(ErrorCode As Integer, ErrorDesc As String)
- On Error Resume Next
- dsSocket1.Close
- dsSocket2.Close
- Text1 = Text1 & vbCrLf & Description & vbCrLf
- End Sub
- Private Sub dsSocket2_Receive(ReceiveData As String)
- Text1 = Text1 & ReceiveData & vbCrLf
- If InStr(ReceiveData, "/dns") Then
- 'this one will get the ip of another user.
- 'example: /dns nick
- theLen$ = Len(ReceiveData) - 5 'gets the len of the nick name
- thePerson$ = Right$(ReceiveData, theLen$) 'gets the name of the person
- If LCase(thePerson$) = LCase(txtHandle) Then
- dsSocket2.Send = "user: " & txtHandle & " - " & dsSocket1.LocalDotAddr
- 'this part checks to see if the user is you.
- 'if it is, it will send your IP# to the chat.
- 'how hackerish .. rofl. (just like irc kids)
- End If
- End If
- 'you could put in some commands if ya wanted..
- 'its pretty simple acually ... just do it like chat
- 'commands .... split the text up and use a trigger
- 'word like "/dns" and then get the text after it
- '(the user name to get the IP from) and then have
- 'it send the info.
- 'hint: you could make a remote admin. client with
- 'the info provided with this. just code
- 'commands in a server and your set.
-
- 'have fun with this, and, if someone wants help
- 'with this type of program, please either tell them
- 'where to get my forms, or send them to them
- 'yourself. be a nice person bout it, dont be like
- ' "you need source, code it on your own" cause if
- 'you have these forms, that basically means you
- 'couldn't do it on your own. 8^)
- ' -senate
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- On Error Resume Next
- dsSocket1.Close
- dsSocket2.Close
- client.dsSocket1.Close
- Unload Me
- Unload server
- End Sub
- Private Sub Text2_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then 'if the enter key is pressed
- Packet$ = txtHandle & ": " & Text2 'puts handle and text together into a string to send
- dsSocket2.Send = Packet$ 'sends packet
- Text1 = Text1 & Packet$ & vbCrLf
- Text2 = "" 'clears the textbox
- 'of the text in it
- End If
- End Sub
-