如果你有該永動(dòng)機(jī)的登陸用戶名和密碼.那簡(jiǎn)單了.
公司主營(yíng)業(yè)務(wù):做網(wǎng)站、網(wǎng)站設(shè)計(jì)、移動(dòng)網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實(shí)現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競(jìng)爭(zhēng)能力。創(chuàng)新互聯(lián)是一支青春激揚(yáng)、勤奮敬業(yè)、活力青春激揚(yáng)、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊(duì)。公司秉承以“開放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對(duì)我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)推出大同免費(fèi)做網(wǎng)站回饋大家。
Shell("c:\windows\system32\cmd.exe /c net use \\192.168.0.199 """"" " /user:" """guest""")
里面冒號(hào)太多了.你可以通過CHR去轉(zhuǎn)換里面中的一些冒號(hào).
這句話可以不要人為去輸入用戶名和密碼.
另外如果你可以使用
My.Computer.Network.DownloadFile()
函數(shù)去進(jìn)行文件下載.這個(gè)比較方便 .
用 vb.net socket通信
Dim th As Threading.Thread
2 Dim tcpl As System.Net.Sockets.TcpListener
3
4 Private Sub Form1_Load()Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
5 th = New System.Threading.Thread(New System.Threading.ThreadStart(AddressOf MyListen))
6 th.Start()
7 End Sub
8
9 Public Sub SendMessage()Sub SendMessage(ByVal IP As String, ByVal SendMsg As String)
10 Try
11 If IP "" Then
12 Dim tcpc As New System.Net.Sockets.TcpClient(IP, 5656)
13 Dim tcpStream As Net.Sockets.NetworkStream = tcpc.GetStream
14 Dim reqStream As New IO.StreamWriter(tcpStream)
15 reqStream.Write(SendMsg)
16 reqStream.Flush()
17 tcpStream.Close()
18 tcpc.Close()
19 End If
20 Catch ex As Exception
21 MsgBox(ex.Message.ToString)
22 End Try
23 End Sub
24 Private Sub MyListen()Sub MyListen()
25 Try
26 Dim ipAddress As System.Net.IPAddress = System.Net.Dns.Resolve(System.Net.Dns.GetHostName).AddressList(0)
27 tcpl = New System.Net.Sockets.TcpListener(ipAddress, 5656)
28 tcpl.Start()
29 While True
30 Dim s As System.Net.Sockets.Socket = tcpl.AcceptSocket()
31 Dim MyBuffer(1024) As Byte
32 Dim i As Integer
33 i = s.Receive(MyBuffer)
34 If i 0 Then
35 Dim lstrRec As String
36 Dim j As Integer
37 For j = 0 To i - 1
38 TextBox1.Text += Chr(MyBuffer(j)) ","
39 Next
40 End If
41 End While
42 Catch ex As Exception
43 MsgBox(ex.Message.ToString)
44 End Try
45 End Sub
46
47 Private Sub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
48 SendMessage("192.168.0.61", TextBox2.Text)
49 End Sub
你這段代碼可以獲得該主機(jī)名下的所有ip,每個(gè)ip地址都是有類型簇的,可以區(qū)別本地地址和網(wǎng)絡(luò)地址、ip6地址。
你獲取索引為0的ip,不一定是正確的網(wǎng)絡(luò)地址,它有時(shí)順序在中間,在后面。
應(yīng)該獲取所有ip,再通過ip地址簇類型區(qū)分
判斷連接本身有一個(gè)函數(shù),不過有時(shí)沒聯(lián)網(wǎng)也是真。
可以用ping,ping百度、ping訪問速度快、不經(jīng)常維護(hù)斷線的網(wǎng)絡(luò)主機(jī)。
既然從網(wǎng)上找的實(shí)例沒問題,也許就是調(diào)用的時(shí)候沒出來或者在檢測(cè)網(wǎng)卡當(dāng)中出現(xiàn)了問題。