Click here to Skip to main content
15,891,184 members
Home / Discussions / C#
   

C#

 
GeneralRe: Execute Multiple Commands using Process.StandardInput Pin
Django_Untaken7-May-15 0:47
Django_Untaken7-May-15 0:47 
GeneralRe: Execute Multiple Commands using Process.StandardInput Pin
Sascha Lefèvre7-May-15 1:00
professionalSascha Lefèvre7-May-15 1:00 
GeneralRe: Execute Multiple Commands using Process.StandardInput Pin
Eddy Vluggen7-May-15 1:16
professionalEddy Vluggen7-May-15 1:16 
GeneralRe: Execute Multiple Commands using Process.StandardInput Pin
Django_Untaken7-May-15 1:58
Django_Untaken7-May-15 1:58 
GeneralRe: Execute Multiple Commands using Process.StandardInput Pin
Eddy Vluggen7-May-15 2:18
professionalEddy Vluggen7-May-15 2:18 
GeneralRe: Execute Multiple Commands using Process.StandardInput Pin
Django_Untaken8-May-15 0:00
Django_Untaken8-May-15 0:00 
GeneralRe: Execute Multiple Commands using Process.StandardInput Pin
Eddy Vluggen8-May-15 1:40
professionalEddy Vluggen8-May-15 1:40 
QuestionHow know the state connected for udp client Pin
hasan hadi6-May-15 17:13
hasan hadi6-May-15 17:13 
Hi,

Iam Know how send and received but problem how know the state connected with IP , Port

this my code

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
 

namespace etherent_send_and_recive_data
{
    public partial class Form1 : Form
    {
        UdpClient udpClient;
 
        private IPEndPoint ipend;
        public Form1()
        {
 
            InitializeComponent();
            udpClient = new UdpClient();
           
        }
 
        private void send_data_through_etherent( string send_data_ETH)
        {
          
            byte[] senddataETH = ASCIIEncoding.ASCII.GetBytes(send_data_ETH);
            udpClient.Send(senddataETH,4);
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            int port;
            byte res;
            button1.Text = "disconnected";
            port = int.Parse(textBox2.Text);
            ipend = new IPEndPoint(IPAddress.Parse(textBox1.Text), port);
 
 
                try
                {
                    udpClient.Connect(ipend);
                }
                finally
                {
                    button1.Text = "connected";  
                }
            
        }
 
       
        private void switch1_StateChanged(object sender, NationalInstruments.UI.ActionEventArgs e)
        {
            if(switch1.Value==true)send_data_through_etherent("S11E");
            else send_data_through_etherent("S10E");
        }
 
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
          if(textBox2.Text != string.Empty)
            {
                if (textBox1.TextLength >= 11) button1.Enabled = true;
            }
        }
 
        private void textBox2_TextChanged(object sender, EventArgs e)
        {
          if (textBox2.Text != string.Empty)
            {
                if (textBox1.TextLength >= 11) button1.Enabled = true;
            }
        }
 
       
 
    }
 
}



the problem now in code button1_Click I need know the real state for connected for example if connected the button.text="connected" if closed or not connected button.text="disconnected"

how code for udp client about connected and closed

Regards
AnswerRe: How know the state connected for udp client Pin
Dave Kreskowiak6-May-15 17:23
mveDave Kreskowiak6-May-15 17:23 
GeneralRe: How know the state connected for udp client Pin
hasan hadi6-May-15 23:29
hasan hadi6-May-15 23:29 
GeneralRe: How know the state connected for udp client Pin
Dave Kreskowiak7-May-15 1:24
mveDave Kreskowiak7-May-15 1:24 
GeneralRe: How know the state connected for udp client Pin
hasan hadi7-May-15 3:17
hasan hadi7-May-15 3:17 
AnswerRe: How know the state connected for udp client Pin
F-ES Sitecore6-May-15 23:28
professionalF-ES Sitecore6-May-15 23:28 
GeneralRe: How know the state connected for udp client Pin
hasan hadi6-May-15 23:35
hasan hadi6-May-15 23:35 
AnswerRe: How know the state connected for udp client Pin
hasan hadi10-May-15 16:12
hasan hadi10-May-15 16:12 
QuestionSQL Server Connection Best Practice Pin
JBHowl6-May-15 8:58
JBHowl6-May-15 8:58 
AnswerRe: SQL Server Connection Best Practice Pin
Richard Deeming6-May-15 9:28
mveRichard Deeming6-May-15 9:28 
AnswerRe: SQL Server Connection Best Practice Pin
Dave Kreskowiak6-May-15 11:11
mveDave Kreskowiak6-May-15 11:11 
AnswerRe: SQL Server Connection Best Practice Pin
F-ES Sitecore6-May-15 22:39
professionalF-ES Sitecore6-May-15 22:39 
QuestionCreating Large, Blank Bitmaps Pin
JBHowl6-May-15 3:39
JBHowl6-May-15 3:39 
AnswerRe: Creating Large, Blank Bitmaps Pin
Dave Kreskowiak6-May-15 4:15
mveDave Kreskowiak6-May-15 4:15 
GeneralRe: Creating Large, Blank Bitmaps Pin
JBHowl6-May-15 4:41
JBHowl6-May-15 4:41 
GeneralRe: Creating Large, Blank Bitmaps Pin
Eddy Vluggen6-May-15 5:14
professionalEddy Vluggen6-May-15 5:14 
GeneralRe: Creating Large, Blank Bitmaps Pin
Dave Kreskowiak6-May-15 11:07
mveDave Kreskowiak6-May-15 11:07 
AnswerRe: Creating Large, Blank Bitmaps Pin
Pete O'Hanlon6-May-15 5:00
mvePete O'Hanlon6-May-15 5:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.