用 vb.net socket通信
創(chuàng)新新互聯(lián),憑借十多年的成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站經(jīng)驗(yàn),本著真心·誠心服務(wù)的企業(yè)理念服務(wù)于成都中小企業(yè)設(shè)計(jì)網(wǎng)站有上千案例。做網(wǎng)站建設(shè),選成都創(chuàng)新互聯(lián)。
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
My.Computer.Audio.Play("文件路徑及文件名")就可以了,vb.net沒有必要用API
下面是讀取嵌入式文件:
Dim res As Stream = Assembly.GetEntryAssembly.GetManifestResourceStream("ring.wav")
Dim bytes(res.Length - 1) As Byte
res.Read(bytes, 0, bytes.Length)
My.Computer.Audio.Play(bytes, AudioPlayMode.Background)
'注意生成操作哪里要選擇:嵌入的資源
樓主你好,你所指的那個(gè)指令就是"winchat",Windows自帶的局域網(wǎng)聊天工具.使用方法:開始--運(yùn)行--輸入winchat,就可以打開Winchat了.只能實(shí)現(xiàn)很簡單的功能,并且是中文,沒什么好介紹的,相信你一看就懂,希望可以幫到你!
ps:你所說的電影是杜拉拉升職記吧?貌似那是用的郵件發(fā)的,不小心點(diǎn)成群發(fā)了~嘿嘿..
第一,VB什么時(shí)候都不是世界上使用人數(shù)最多的語言。其次,我真的不知道VB這東西有什么好的,如果說VB給當(dāng)初困擾中的windows程序員們提供了一個(gè)所見即所得的UI開發(fā)環(huán)境,那么其實(shí)他們真的應(yīng)該多關(guān)注Delphi、C++
Builder。第三,.NET跟微軟的web
service也沒有一毛錢的關(guān)系,微軟第一個(gè)web
service的標(biāo)準(zhǔn)是SOAP,2000年左右出的。VB.NET與其說是VB,不如說是微軟為了挽留VB程序員做的努力。拿VB去比C++更是令人發(fā)指。第四,.NET并非一個(gè)編程語言,C#、VB.NET、托管VC、Delphi
.NET都是.NET家族的。
是。VB.NET是一種簡單,現(xiàn)代,面向?qū)ο蟮挠?jì)算機(jī)編程語言,它由微軟開發(fā),將NETFramework和公共語言運(yùn)行庫的強(qiáng)大功能相結(jié)合,其數(shù)組是包含別的數(shù),可以通過Set集合也能判斷數(shù)組中是否包含指定元素,“數(shù)組”是一組邏輯上相互關(guān)聯(lián)的值。
我從來不加到Controls中也能用,大概這個(gè)不是從Control繼承而來的,所有非可視部件(即組件)估計(jì)都不需要add。