直接上代码:
xmal:
<Window x:Class="UDPSocket.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="600" Width="800" WindowStartupLocation="CenterScreen" Closing="MainWindow_Closing">
<Grid>
<GroupBox Header="发送数据" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="380" Height="545" Background="AliceBlue">
<StackPanel>
<RichTextBox Name="txtSendMssg" HorizontalAlignment="Left" Margin="5" VerticalAlignment="Top" Height="450" Width="355" Background="White"/>
<Button Margin="50 10" Content="发送数据" Height="45" Click="btnSend_Click"/>
</StackPanel>
</GroupBox>
<GroupBox Header="接收数据" HorizontalAlignment="Right" Margin="0,10,10,0" VerticalAlignment="Top" Width="380" Height="545" Background="AliceBlue">
<StackPanel>
<RichTextBox Name="txtRecvMssg" HorizontalAlignment="