Hi Nandini:
I looked at the example but unfortunately you can't select a file to
write to "file:......." only "dstp://". Here's a sample solution you
can test.
sing System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using NationalInstruments.Net;
namespace datasocketest
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private NationalInstruments.Net.DataSocket dataSocketIOREF;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Button Startbutton;
private System.Windows.Forms.TextBox StatusBox;
private const string TargetDataFile = "file:f:/temp/Ref_Data";
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void
dataSocketIOREF_ConnectionStatusUpdated(object sender,
NationalInstruments.Net.ConnectionStatusUpdatedEventArgs e)
{
StatusBox.Text = e.Message;
}
private void Startbutton_Click(object sender, System.EventArgs e)
{
dataSocketIOREF.Connect(TargetDataFile,AccessMode.WriteAutoUpdate);
dataSocketIOREF.Data.Attributes.Add("Timestamp", DateTime.Now);
}
}
}
Best Regards;
Dan