这期内容当中小编将会给大家带来有关如何进行VB.NET实现登陆Ftp的分析,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
今天VB.NET实用教程教你对于VB.NET实现登陆Ftp的方法,快看看学习一下吧。我们都知道远程视频传输可以采用线程下载、图片压缩,还可以考虑先储存进数据库中
VB.NET实用教程代码:
Private sckConnect As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) Private RemoteIp As IPEndPoint Private thd As Thread Private blnExt As Boolean = True Private _Quality As Int16 = 50 Public WriteOnly Property Quality() As Int16 ’这个函数表示服务器要求的图片质量 Set(ByVal value As Int16) _Quality = value End Set End Property Private Sub run() Dim byt() As Byte Dim stream As MemoryStream Dim bmp As Bitmap While blnExt Try bmp = getGrcToBmp() '这是获取图片 stream = New MemoryStream Compress(bmp, stream, _Quality) '这里对图片进行压缩函数 byt = stream.ToArray sckConnect.Send(byt, byt.Length, SocketFlags.None) byt.Initialize() stream = Nothing Thread.Sleep(30) '30毫秒,也就是1秒中传送33次图片 Catch ex As Exception Call Ext() End Try End While End Sub Public Sub Send(ByVal ip As String, ByVal port As Integer) '服务器的IP和Port Try RemoteIp = New IPEndPoint(IPAddress.Parse(ip), port) sckConnect.SendTimeout = 100 sckConnect.Connect(RemoteIp) If sckConnect.Connected Then thd = New Thread(AddressOf run) thd.Start() End If Catch ex As Exception MsgBox(ex.Message) Exit Sub End Try End Sub Public Sub Ext() Try blnExt = False thd = Nothing sckConnect.Disconnect(True) sckConnect.Close() Catch ex As Exception End Try End Sub
上述就是小编为大家分享的如何进行VB.NET实现登陆Ftp的分析了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注编程网行业资讯频道。