IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

C# et Measurement Studio


Sujet :

C#

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Étudiant
    Inscrit en
    Avril 2011
    Messages
    12
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2011
    Messages : 12
    Par défaut C# et Measurement Studio
    Bonjour à tous et à toutes,

    Je dois développer une application à l'aide de la bibliothèque de Measurement Studio en C#. Je dois utiliser la classe Socket, mais je ne comprends pas comment fonctionne l'outil spécialisé dans Measurement Studio.

    Mon projet : un capteur renvoie une donnée (vitesse) déjà traitée par un processeur, j'ai accès au client via à un routeur et câble ethernet, je dois la récupérer en utilisant des sockets, l'afficher, et la commander.

    Je n'arrive pas à établir la connexion avec les outils DataSocket de MS. Si quelqu'un avait un exemple de code simple et commenté pour configurer le dialogue entre client et serveur, je suis preneur. S'il existe des cours ou tuto's sur le net, je suis preneur aussi, car j'ai passé un sacré bout de temps sur internet et j'ai pas trouvé grand chose d'intéressant.

    Merci d'avance, et bonne journée à tous les lecteurs.

    Brygoth

  2. #2
    Membre éprouvé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Avril 2006
    Messages
    1 627
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2006
    Messages : 1 627
    Par défaut
    Tourne toi vers le support de l'éditeur de ta librairie, ils seront les plus à même de t'aider : http://sine.ni.com/psp/app/doc/p/id/psp-317

  3. #3
    Expert confirmé

    Homme Profil pro
    Chef de projet NTIC
    Inscrit en
    Septembre 2006
    Messages
    3 580
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Chef de projet NTIC
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Septembre 2006
    Messages : 3 580
    Par défaut
    Le support et surtout, les exemples fournis par NI sur son produit.

    J'avais téléchargé à l'époque la version "trial" et il me semble que beaucoup d'exemples couvraient la majorité des fonctionnalités de la librairie.

  4. #4
    Membre averti
    Profil pro
    Étudiant
    Inscrit en
    Avril 2011
    Messages
    12
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2011
    Messages : 12
    Par défaut
    J'ai fais quelques recherches, je n'ai pas trouvé mon bonheur, mais j'ai quelques questions :

    Faut-il utiliser l'objet DataSocket sur l'interface graphique (enfin en dessous) ou bien créer une socket manuellement : Exemples de codes ici
    Comment faut-il configurer le socket pour se connecter et recevoir des données ? (méthode Connect(), ReceiveData, ... ?)
    Faut-il créer un EndPoint ? Utiliser la méthode Bind ?

    Je n'arrive pas à connecter l'application et le client, même en console sans les outils measurement studio la connexion ne se fait pas (Exemples de codes ici)

    Voici un exemple provenant directement de la bibliothèque Measurement Studio, mais j'ai beaucoup de mal à saisir les parties (read et write) :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
     
    using NationalInstruments;
    using NationalInstruments.Net;
    using NationalInstruments.UI.WindowsForms;
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using System.Globalization;
     
    namespace NationalInstruments.Examples.Writer
    {
        public class MainForm : System.Windows.Forms.Form
        {
            private const string TargetUrl = "dstp://localhost/wave";
            private const int BufferSize = 40;
     
            private System.Windows.Forms.Label targetLabel;
            private System.Windows.Forms.Label statusLabel;
            private System.Windows.Forms.TextBox targetTextBox;
            private System.Windows.Forms.TextBox statusTextBox;
            private NationalInstruments.UI.WindowsForms.WaveformGraph writerWaveformGraph;
            private NationalInstruments.UI.XAxis xAxis;
            private NationalInstruments.UI.YAxis yAxis;
            private NationalInstruments.UI.WaveformPlot waveformPlot;
            private System.Windows.Forms.Button connectAutoUpdateButton;
            private System.Windows.Forms.Button connectManualUpdateButton;
            private System.Windows.Forms.Button updateButton;
            private System.Windows.Forms.Button disconnectButton;
            private System.Windows.Forms.CheckBox generateDataCheckBox;
            private System.Windows.Forms.Timer timer;
            private System.Windows.Forms.TrackBar frequencyTrackBar;
            private NationalInstruments.Net.DataSocketServer dataSocketServer;
            private NationalInstruments.Net.DataSocket dataSocket;
            private System.Windows.Forms.Label frequencyLabel;
            private System.Windows.Forms.Label timestampLabel;
            private System.Windows.Forms.TextBox frequencyAttributeTextBox;
            private System.Windows.Forms.TextBox timestampAttributeTextBox;
            private System.Windows.Forms.Label frequencyValueLabel;
            private System.ComponentModel.IContainer components;
     
            public MainForm()
            {
                InitializeComponent();
     
                targetTextBox.Text = TargetUrl;
    			dataSocket.Data.Attributes.Add("Frequency", (double)frequencyTrackBar.Value / 10);	
    			dataSocket.Data.Attributes.Add("Timestamp", DateTime.Now);
            }
     
            #region Windows Form Designer generated code
            private void InitializeComponent()
            {
    			this.components = new System.ComponentModel.Container();
    			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
    			this.targetLabel = new System.Windows.Forms.Label();
    			this.statusLabel = new System.Windows.Forms.Label();
    			this.targetTextBox = new System.Windows.Forms.TextBox();
    			this.statusTextBox = new System.Windows.Forms.TextBox();
    			this.writerWaveformGraph = new NationalInstruments.UI.WindowsForms.WaveformGraph();
    			this.waveformPlot = new NationalInstruments.UI.WaveformPlot();
    			this.xAxis = new NationalInstruments.UI.XAxis();
    			this.yAxis = new NationalInstruments.UI.YAxis();
    			this.connectAutoUpdateButton = new System.Windows.Forms.Button();
    			this.connectManualUpdateButton = new System.Windows.Forms.Button();
    			this.updateButton = new System.Windows.Forms.Button();
    			this.disconnectButton = new System.Windows.Forms.Button();
    			this.frequencyTrackBar = new System.Windows.Forms.TrackBar();
    			this.generateDataCheckBox = new System.Windows.Forms.CheckBox();
    			this.timer = new System.Windows.Forms.Timer(this.components);
    			this.dataSocketServer = new NationalInstruments.Net.DataSocketServer(this.components);
    			this.dataSocket = new NationalInstruments.Net.DataSocket(this.components);
    			this.frequencyLabel = new System.Windows.Forms.Label();
    			this.timestampLabel = new System.Windows.Forms.Label();
    			this.frequencyAttributeTextBox = new System.Windows.Forms.TextBox();
    			this.timestampAttributeTextBox = new System.Windows.Forms.TextBox();
    			this.frequencyValueLabel = new System.Windows.Forms.Label();
    			((System.ComponentModel.ISupportInitialize)(this.writerWaveformGraph)).BeginInit();
    			((System.ComponentModel.ISupportInitialize)(this.frequencyTrackBar)).BeginInit();
    			((System.ComponentModel.ISupportInitialize)(this.dataSocketServer)).BeginInit();
    			((System.ComponentModel.ISupportInitialize)(this.dataSocket)).BeginInit();
    			this.SuspendLayout();
    			// 
    			// targetLabel
    			// 
    			this.targetLabel.Location = new System.Drawing.Point(8, 8);
    			this.targetLabel.Name = "targetLabel";
    			this.targetLabel.Size = new System.Drawing.Size(48, 23);
    			this.targetLabel.TabIndex = 0;
    			this.targetLabel.Text = "Target:";
    			// 
    			// statusLabel
    			// 
    			this.statusLabel.Location = new System.Drawing.Point(8, 36);
    			this.statusLabel.Name = "statusLabel";
    			this.statusLabel.Size = new System.Drawing.Size(48, 23);
    			this.statusLabel.TabIndex = 1;
    			this.statusLabel.Text = "Status:";
    			// 
    			// targetTextBox
    			// 
    			this.targetTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    				| System.Windows.Forms.AnchorStyles.Right)));
    			this.targetTextBox.Location = new System.Drawing.Point(60, 8);
    			this.targetTextBox.Name = "targetTextBox";
    			this.targetTextBox.ReadOnly = true;
    			this.targetTextBox.Size = new System.Drawing.Size(424, 20);
    			this.targetTextBox.TabIndex = 2;
    			this.targetTextBox.Text = "";
    			// 
    			// statusTextBox
    			// 
    			this.statusTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    				| System.Windows.Forms.AnchorStyles.Right)));
    			this.statusTextBox.Location = new System.Drawing.Point(60, 36);
    			this.statusTextBox.Name = "statusTextBox";
    			this.statusTextBox.ReadOnly = true;
    			this.statusTextBox.Size = new System.Drawing.Size(424, 20);
    			this.statusTextBox.TabIndex = 3;
    			this.statusTextBox.Text = "";
    			// 
    			// writerWaveformGraph
    			// 
    			this.writerWaveformGraph.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    				| System.Windows.Forms.AnchorStyles.Left) 
    				| System.Windows.Forms.AnchorStyles.Right)));
    			this.writerWaveformGraph.Caption = "DataSocket Writer Data";
    			this.writerWaveformGraph.Location = new System.Drawing.Point(156, 68);
    			this.writerWaveformGraph.Name = "writerWaveformGraph";
    			this.writerWaveformGraph.Plots.AddRange(new NationalInstruments.UI.WaveformPlot[] {
    																							this.waveformPlot});
    			this.writerWaveformGraph.Size = new System.Drawing.Size(332, 208);
    			this.writerWaveformGraph.TabIndex = 4;
    			this.writerWaveformGraph.XAxes.AddRange(new NationalInstruments.UI.XAxis[] {
    																					 this.xAxis});
    			this.writerWaveformGraph.YAxes.AddRange(new NationalInstruments.UI.YAxis[] {
    																					 this.yAxis});
    			// 
    			// waveformPlot
    			// 
    			this.waveformPlot.XAxis = this.xAxis;
    			this.waveformPlot.YAxis = this.yAxis;
    			// 
    			// connectAutoUpdateButton
    			// 
    			this.connectAutoUpdateButton.Location = new System.Drawing.Point(8, 68);
    			this.connectAutoUpdateButton.Name = "connectAutoUpdateButton";
    			this.connectAutoUpdateButton.Size = new System.Drawing.Size(144, 23);
    			this.connectAutoUpdateButton.TabIndex = 5;
    			this.connectAutoUpdateButton.Text = "Connect (Auto Update)";
    			this.connectAutoUpdateButton.Click += new System.EventHandler(this.OnConnectAutoUpdateClick);
    			// 
    			// connectManualUpdateButton
    			// 
    			this.connectManualUpdateButton.Location = new System.Drawing.Point(8, 96);
    			this.connectManualUpdateButton.Name = "connectManualUpdateButton";
    			this.connectManualUpdateButton.Size = new System.Drawing.Size(144, 23);
    			this.connectManualUpdateButton.TabIndex = 6;
    			this.connectManualUpdateButton.Text = "Connect (Manual Update)";
    			this.connectManualUpdateButton.Click += new System.EventHandler(this.OnConnectManualUpdateClick);
    			// 
    			// updateButton
    			// 
    			this.updateButton.Location = new System.Drawing.Point(8, 124);
    			this.updateButton.Name = "updateButton";
    			this.updateButton.Size = new System.Drawing.Size(144, 23);
    			this.updateButton.TabIndex = 7;
    			this.updateButton.Text = "Update";
    			this.updateButton.Click += new System.EventHandler(this.OnUpdateClick);
    			// 
    			// disconnectButton
    			// 
    			this.disconnectButton.Location = new System.Drawing.Point(8, 152);
    			this.disconnectButton.Name = "disconnectButton";
    			this.disconnectButton.Size = new System.Drawing.Size(144, 23);
    			this.disconnectButton.TabIndex = 8;
    			this.disconnectButton.Text = "Disconnect";
    			this.disconnectButton.Click += new System.EventHandler(this.OnDisconnectClick);
    			// 
    			// frequencyTrackBar
    			// 
    			this.frequencyTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
    				| System.Windows.Forms.AnchorStyles.Right)));
    			this.frequencyTrackBar.Location = new System.Drawing.Point(156, 284);
    			this.frequencyTrackBar.Name = "frequencyTrackBar";
    			this.frequencyTrackBar.Size = new System.Drawing.Size(332, 45);
    			this.frequencyTrackBar.TabIndex = 9;
    			this.frequencyTrackBar.ValueChanged += new System.EventHandler(this.OnFrequencyValueChanged);
    			// 
    			// generateDataCheckBox
    			// 
    			this.generateDataCheckBox.Checked = true;
    			this.generateDataCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
    			this.generateDataCheckBox.Location = new System.Drawing.Point(8, 180);
    			this.generateDataCheckBox.Name = "generateDataCheckBox";
    			this.generateDataCheckBox.Size = new System.Drawing.Size(144, 24);
    			this.generateDataCheckBox.TabIndex = 10;
    			this.generateDataCheckBox.Text = "Generate Data";
    			this.generateDataCheckBox.CheckedChanged += new System.EventHandler(this.OnGenerateDataCheckedChanged);
    			// 
    			// timer
    			// 
    			this.timer.Enabled = true;
    			this.timer.Tick += new System.EventHandler(this.OnTimerTick);
    			// 
    			// dataSocket
    			// 
    			this.dataSocket.AutoConnect = false;
    			this.dataSocket.ConnectionStatusUpdated += new NationalInstruments.Net.ConnectionStatusUpdatedEventHandler(this.OnDataSocketConnectionStatusUpdated);
    			// 
    			// frequencyLabel
    			// 
    			this.frequencyLabel.Location = new System.Drawing.Point(8, 220);
    			this.frequencyLabel.Name = "frequencyLabel";
    			this.frequencyLabel.Size = new System.Drawing.Size(64, 23);
    			this.frequencyLabel.TabIndex = 11;
    			this.frequencyLabel.Text = "Frequency:";
    			// 
    			// timestampLabel
    			// 
    			this.timestampLabel.Location = new System.Drawing.Point(8, 248);
    			this.timestampLabel.Name = "timestampLabel";
    			this.timestampLabel.Size = new System.Drawing.Size(64, 23);
    			this.timestampLabel.TabIndex = 12;
    			this.timestampLabel.Text = "Timestamp:";
    			// 
    			// frequencyAttributeTextBox
    			// 
    			this.frequencyAttributeTextBox.Location = new System.Drawing.Point(76, 220);
    			this.frequencyAttributeTextBox.Name = "frequencyAttributeTextBox";
    			this.frequencyAttributeTextBox.ReadOnly = true;
    			this.frequencyAttributeTextBox.Size = new System.Drawing.Size(76, 20);
    			this.frequencyAttributeTextBox.TabIndex = 13;
    			this.frequencyAttributeTextBox.Text = "";
    			// 
    			// timestampAttributeTextBox
    			// 
    			this.timestampAttributeTextBox.Location = new System.Drawing.Point(76, 248);
    			this.timestampAttributeTextBox.Name = "timestampAttributeTextBox";
    			this.timestampAttributeTextBox.ReadOnly = true;
    			this.timestampAttributeTextBox.Size = new System.Drawing.Size(76, 20);
    			this.timestampAttributeTextBox.TabIndex = 14;
    			this.timestampAttributeTextBox.Text = "";
    			// 
    			// frequencyValueLabel
    			// 
    			this.frequencyValueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    			this.frequencyValueLabel.Location = new System.Drawing.Point(88, 290);
    			this.frequencyValueLabel.Name = "frequencyValueLabel";
    			this.frequencyValueLabel.Size = new System.Drawing.Size(64, 23);
    			this.frequencyValueLabel.TabIndex = 15;
    			this.frequencyValueLabel.Text = "Frequency:";
    			// 
    			// MainForm
    			// 
    			this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
    			this.ClientSize = new System.Drawing.Size(492, 323);
    			this.Controls.Add(this.frequencyValueLabel);
    			this.Controls.Add(this.timestampAttributeTextBox);
    			this.Controls.Add(this.frequencyAttributeTextBox);
    			this.Controls.Add(this.statusTextBox);
    			this.Controls.Add(this.targetTextBox);
    			this.Controls.Add(this.timestampLabel);
    			this.Controls.Add(this.frequencyLabel);
    			this.Controls.Add(this.frequencyTrackBar);
    			this.Controls.Add(this.disconnectButton);
    			this.Controls.Add(this.updateButton);
    			this.Controls.Add(this.connectManualUpdateButton);
    			this.Controls.Add(this.connectAutoUpdateButton);
    			this.Controls.Add(this.writerWaveformGraph);
    			this.Controls.Add(this.statusLabel);
    			this.Controls.Add(this.targetLabel);
    			this.Controls.Add(this.generateDataCheckBox);
    			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
    			this.MinimumSize = new System.Drawing.Size(500, 350);
    			this.Name = "MainForm";
    			this.Text = "DataSocket Writer";
    			((System.ComponentModel.ISupportInitialize)(this.writerWaveformGraph)).EndInit();
    			((System.ComponentModel.ISupportInitialize)(this.frequencyTrackBar)).EndInit();
    			((System.ComponentModel.ISupportInitialize)(this.dataSocketServer)).EndInit();
    			((System.ComponentModel.ISupportInitialize)(this.dataSocket)).EndInit();
    			this.ResumeLayout(false);
     
    		}
            #endregion
     
            protected override void Dispose(bool disposing)
            {
                if (disposing)
                {
                    if (components != null)
                        components.Dispose();
                }
     
                base.Dispose(disposing);
            }
     
            [STAThread]
            public static void Main()
            {
                Application.Run(new MainForm());
            }
     
            private void OnTimerTick(object sender, System.EventArgs e)
            {
                frequencyTrackBar.Value = ((frequencyTrackBar.Value == 10) ? 1 : (frequencyTrackBar.Value + 1));
            }
     
            private void OnFrequencyValueChanged(object sender, System.EventArgs e)
            {
                double[] data = new double[BufferSize];
                double frequencyValue = (double)frequencyTrackBar.Value / 10;
                DateTime timestampValue = DateTime.Now;
     
                frequencyAttributeTextBox.Text = frequencyValue.ToString(CultureInfo.InvariantCulture);
                timestampAttributeTextBox.Text = timestampValue.ToString("T", CultureInfo.InvariantCulture);
     
                for (int i = 0; i < BufferSize; ++i)
                    data[i] = Math.Sin(i * frequencyValue);
     
                waveformPlot.PlotY(data);
     
                if (dataSocket.IsConnected)
                {
                    dataSocket.Data.Value = data;							
    				dataSocket.Data.Attributes["Frequency"].Value = frequencyValue;				
    				dataSocket.Data.Attributes["Timestamp"].Value = timestampValue;
                }
            }
     
            private void OnDataSocketConnectionStatusUpdated(object sender, NationalInstruments.Net.ConnectionStatusUpdatedEventArgs e)
            {
                statusTextBox.Text = e.Message;
            }
     
            private void OnGenerateDataCheckedChanged(object sender, System.EventArgs e)
            {
                if (generateDataCheckBox.Checked)
                    timer.Start();
                else
                    timer.Stop();
            }
     
            private void OnConnectAutoUpdateClick(object sender, System.EventArgs e)
            {
                if (dataSocket.IsConnected)
                    dataSocket.Disconnect();
     
                dataSocket.Connect(TargetUrl, AccessMode.WriteAutoUpdate);        
            }
     
            private void OnConnectManualUpdateClick(object sender, System.EventArgs e)
            {
                if (dataSocket.IsConnected)
                    dataSocket.Disconnect();
     
                dataSocket.Connect(TargetUrl, AccessMode.Write);
            }
     
            private void OnUpdateClick(object sender, System.EventArgs e)
            {
                dataSocket.Update();
            }
     
            private void OnDisconnectClick(object sender, System.EventArgs e)
            {
                dataSocket.Disconnect();
            }
        }
    }
    Je suis un peu perdu, je n'avance pas depuis quelques jours, y'aurait-il un connaisseur des outils Measurement Studio patient qui pourrait me guider ?

    Merci d'avance, bonne journée à tous les lecteurs du site.

  5. #5
    Membre éprouvé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2011
    Messages
    79
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2011
    Messages : 79
    Par défaut
    Bonsoir,

    je travaille sur un soft basé sur une communication et un échange de
    données inter-process et DataSocket avait été utilisé il y a quelques années...
    Depuis, nous avons abandonné cette solution car pas très fiable !!!
    cela dit, les débits requis étaient conséquents, peut-être trop pour DataSocket.

    Avez vous réellement besoin de ce component ? une communication classique
    par socket "classique" ne suffit-elle pas ?

  6. #6
    Membre averti
    Profil pro
    Étudiant
    Inscrit en
    Avril 2011
    Messages
    12
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2011
    Messages : 12
    Par défaut
    Je vais me passer de cet outil et utiliser les sockets classique (.NET).

    En fait je débute dans le monde des sockets, et je pensais plus simple d'utiliser un outil déjà "configuré" mais il n'y a pas assez d'info sur le net contrairement à la class socket de .NET.

    J'ai un soucis avec la méthode "bind" lorsque j’établis mon point d'écoute, elle me renvoie une erreur :
    Une seule utilisation de chaque adresse de socket (protocole/adresse réseau/port) est habituellement autorisée
    Voilà le constructeur de ma classe UDP, c'est ici qu'apparaît l'erreur.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    public UDP()
            {
                port = 50000;
                IPEndPoint endpointReceive = new IPEndPoint(IPAddress.Any, port);
                socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                socket.Bind(endpointReceive);
     
                sendSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     
                IPEndPoint endpointTransmit = new IPEndPoint(IPAddress.Parse("192.168.0.255"), port);
                sendSocket.Connect(endpointTransmit);
     
     
                buffer = new List<Packet>(); //packet est une classe de mon programme
     
                receivingThread = new Thread(new ThreadStart(receiving));
                receivingThread.Name = "UDP receiving thread";
                receivingThread.Start();
     
               // Console.WriteLine("UDP opgestart");
            }
    Je ne comprends pas tellement le pourquoi du comment cette erreur, je suis dessus depuis une semaine maintenant, et ça bloque ^_^ Pourtant le concept est simple ...

    Avez vous une idée du problème qui apparaît ?

    Merci

Discussions similaires

  1. C#.net & LabVIEW or Measurement Studio
    Par kato73 dans le forum C#
    Réponses: 1
    Dernier message: 08/05/2011, 22h24
  2. setup avec Measurement Studio
    Par 3aychoucha dans le forum LabVIEW
    Réponses: 0
    Dernier message: 23/02/2011, 17h31
  3. [Measurement Studio] axCWGraph PlotY
    Par 3aychoucha dans le forum LabVIEW
    Réponses: 2
    Dernier message: 18/02/2011, 14h10
  4. [Measurement Studio] Fonction WaveformGraph1.PlotY
    Par nico9360 dans le forum LabVIEW
    Réponses: 1
    Dernier message: 11/11/2008, 17h02

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo