Skip to content

Instantly share code, notes, and snippets.

@immengineer
Last active February 17, 2018 04:29
Show Gist options
  • Save immengineer/5873f97b7f2fb52272db4a498a951e85 to your computer and use it in GitHub Desktop.
Save immengineer/5873f97b7f2fb52272db4a498a951e85 to your computer and use it in GitHub Desktop.
MemoryMappedFile受信側
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