| 使用VB的Socket开发网络版来电管理软件 |  
		
		  | chen在2007/8/4发表,被浏览6852次
 | 
	   
	  
适合对象:记得来电显示管理器的网络版  开发环境:Visual Basic  下载范例:JDDemo2.zip  使用环境:需要来电监听服务程序TeleListen.exe(点击下载)  相关连接:来电管理器服务程序  备注:采用Socket网络技术,需要使用Microsoft WinSock Control 
 
     VERSION 5.00  Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"  Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"  Begin VB.Form Form2      Caption         =   "来电显示客户端"     ClientHeight    =   3285     ClientLeft      =   60     ClientTop       =   450     ClientWidth     =   4680     LinkTopic       =   "Form1"     ScaleHeight     =   3285     ScaleWidth      =   4680     StartUpPosition =   3  '窗口缺省     Begin MSWinsockLib.Winsock Winsock1         Left            =   1800        Top             =   960        _ExtentX        =   741        _ExtentY        =   741        _Version        =   393216     End     Begin VB.CommandButton Command2         Caption         =   "关闭"        Height          =   495        Left            =   3120        TabIndex        =   6        Top             =   2640        Width           =   1335     End     Begin VB.CommandButton Command1         Caption         =   "连接"        Height          =   495        Left            =   3120        TabIndex        =   5        Top             =   1920        Width           =   1335     End     Begin RichTextLib.RichTextBox rtbMsg         Height          =   3015        Left            =   120        TabIndex        =   4        Top             =   120        Width           =   2775        _ExtentX        =   4895        _ExtentY        =   5318        _Version        =   393217        Enabled         =   -1  'True        TextRTF         =   $"Form2.frx":0000     End     Begin VB.TextBox Text2         Height          =   375        Left            =   3120        TabIndex        =   3        Text            =   "3825"        Top             =   1320        Width           =   1335     End     Begin VB.TextBox Text1         Height          =   375        Left            =   3120        TabIndex        =   0        Text            =   "127.0.0.1"        Top             =   360        Width           =   1335     End     Begin VB.Label Label2         Caption         =   "Socket端口"        Height          =   255        Left            =   3120        TabIndex        =   2        Top             =   1080        Width           =   1215     End     Begin VB.Label Label1         Caption         =   "服务器地址"        Height          =   255        Left            =   3120        TabIndex        =   1        Top             =   120        Width           =   975     End  End  Attribute VB_Name = "Form2"  Attribute VB_GlobalNameSpace = False  Attribute VB_Creatable = False  Attribute VB_PredeclaredId = True  Attribute VB_Exposed = False  Private Sub Command1_Click()                On Error GoTo ErrorPro        With Winsock1                .RemoteHost = Text1.Text          .RemotePort = CInt(Text2.Text)          .Connect            Exit Sub      End With    ErrorPro:        rtbMsg.Text = rtbMsg.Text & "服务器未开或网络出错!" & Chr(10)         End Sub    Private Sub Command2_Click()            Winsock1.Close      rtbMsg.Text = rtbMsg.Text & "已关闭连接" & Chr(10)        End Sub    Private Sub Form_Load()        rtbMsg.Text = ""        End Sub    Private Sub Winsock1_Connect()            rtbMsg.Text = rtbMsg.Text & "连接成功" & Chr(10)        End Sub    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)        Dim s As String      Dim p As Integer            Winsock1.GetData s      If Mid(s, 1, 1) = "#" Then          p = InStr(s, " ")          rtbMsg.Text = rtbMsg.Text & "来电号码: " & Mid(s, 2, p - 2) & Chr(10)          rtbMsg.Text = rtbMsg.Text & "来电时间: " & Mid(s, p + 1, 19) & Chr(10)      End If    End Sub
		 |  
	  | 
		
		 |  
	 
	 | 
    
	   |