Last active
February 17, 2018 04:29
-
-
Save immengineer/5873f97b7f2fb52272db4a498a951e85 to your computer and use it in GitHub Desktop.
MemoryMappedFile受信側
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
} | |
private void button1_Click(object sender, EventArgs e) | |
{ | |
textBox1.Text = ""; | |
try | |
{ | |
using (var mmf = MemoryMappedFile.OpenExisting("Test")) | |
using (var stream = mmf.CreateViewStream()) | |
using (StreamReader sr = new StreamReader(stream)) | |
{ | |
while (!sr.EndOfStream) | |
{ | |
textBox1.Text = sr.ReadLine(); | |
} | |
} | |
} | |
catch (Exception ex) | |
{ | |
MessageBox.Show(ex.Message); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment