重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
楼主你好,你所指的那个指令就是"winchat",Windows自带的局域网聊天工具.使用方法:开始--运行--输入winchat,就可以打开Winchat了.只能实现很简单的功能,并且是中文,没什么好介绍的,相信你一看就懂,希望可以帮到你!
成都创新互联专业为企业提供海晏网站建设、海晏做网站、海晏网站设计、海晏网站制作等企业网站建设、网页设计与制作、海晏企业网站模板建站服务,十多年海晏做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
ps:你所说的电影是杜拉拉升职记吧?貌似那是用的邮件发的,不小心点成群发了~嘿嘿..
‘客户端向这样写:在窗体说放两个文本框、两个标签、两个按钮、一个列表框
Imports System.Net
Imports System.Net.Sockets
Imports System.IO
Imports System.Threading
Public Class Form1
'网络基础数据流
Private ns As NetworkStream
Private swriter As StreamWriter
Private nsread As StreamReader
Private tcpclient As TcpClient
Private tcpconnected As Boolean = False
Private clisocket As Socket
Private mythread As Thread
'发送
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Me.TextBox2.Text "" Then
swriter.WriteLine(Me.TextBox2.Text)
swriter.Flush()
Me.TextBox2.Text = ""
Else
MessageBox.Show("发送信息不能为空!", "错误提示")
End If
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'建立连连接
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim ipremote As IPAddress
Dim tcpclient As TcpClient
Try
ipremote = IPAddress.Parse(Me.TextBox1.Text)
Catch ex As Exception
MessageBox.Show("IP地址不合法!", "错误提示")
End Try
Try
tcpclient = New TcpClient(Me.TextBox1.Text, 8000)
ns = tcpclient.GetStream
swriter = New StreamWriter(ns)
Me.StatusBar1.Text = "已经连接上"
Me.Button2.Enabled = False
Me.Button1.Enabled = True
tcpconnected = True
Catch ex As Exception
MessageBox.Show("无法与远程8000端口建立连接!", "错误提示")
End Try
End Sub
Private Sub listen()
Try
Dim tcplistener As New TcpListener(IPAddress.Parse("127.0.0.1"), 8000)
tcplistener.Start()
tcpclient = tcplistener.AcceptTcpClient
ns = tcpclient.GetStream()
nsread = New StreamReader(ns)
While True
Dim msg As String = nsread.ReadLine
If msg = "stop" Then
tcplistener.Stop()
ns.Close()
nsread.Close()
mythread.Abort()
Else
Dim mytime As String = DateTime.Now.ToShortTimeString
Me.ListBox1.Items.Add(mytime + " " + msg)
End If
End While
Catch ex As System.Security.SecurityException
MessageBox.Show("侦听失败!", "错误")
End Try
End Sub
End Class
第一个问题 qq聊天室 必须能 用vb都可以做
第二个问题 vb.net插入数学公式 可以把这些公式封装到一个类中,调用就是了
Server端不是要建立serversocket么,这个类会监听socket连接,客户端连接服务端的时候会携带本机(客户端)的ip,服务器接收连接,经过三次握手之后双方建立tcp连接,然后就可以通讯了,编写服务端的时候并不需要关心客户端发起连接的端口。
获取ip:socket.getInetAddress()
获取端口:socket.getPort();
VB.NET即时窗口用于在设计时调试和计算表达式、执行语句、输出变量值等
快捷键是:CTRL+G 或者按 CTRL+ALT+I