十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
一般出现乱码都是在js裏面跳转到哪个类然後得到这个参数的时候中文乱码,有一个非常实用的法,在js你可以这样写:varurl=..;url=encodeURI(url);url=encodeURI(url);//最重要的部分,两次调用encodeURI,就是编码两次然後在跳转到url所在的类,获取这个参数的方法如下:Stringname=request.getParameter("name");name=URLDecoder.decode(name,"utf8");这样就能解决乱码问题了,这种方法还没遇到过不能解决的乱码,
站在用户的角度思考问题,与客户深入沟通,找到湖口网站设计与湖口网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都做网站、网站设计、企业官网、英文网站、手机端网站、网站推广、空间域名、虚拟主机、企业邮箱。业务覆盖湖口地区。
如果你家里是公网ip或者公网IP能映射内网IP的话可以直接搭一个服务器,否则只能使用内网穿透软件然后再搭建服务器。如应用服务器、网页服务器、电子邮件服务、 FTP 服务器等等都可以进行消息交流。
‘客户端向这样写:在窗体说放两个文本框、两个标签、两个按钮、一个列表框
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