Click here to Skip to main content
15,887,240 members
Home / Discussions / C#
   

C#

 
QuestionHow to execute SP from access in C# Pin
Pankaj Deharia6-Mar-09 18:34
professionalPankaj Deharia6-Mar-09 18:34 
QuestionNext Form Pin
Sajjad Leo6-Mar-09 17:58
Sajjad Leo6-Mar-09 17:58 
AnswerRe: Next Form Pin
Xmen Real 6-Mar-09 18:50
professional Xmen Real 6-Mar-09 18:50 
AnswerRe: Next Form Pin
K V Sekhar6-Mar-09 20:38
K V Sekhar6-Mar-09 20:38 
QuestionReference to undeclared entity 'nbsp' Pin
C. Hariharan6-Mar-09 17:11
C. Hariharan6-Mar-09 17:11 
AnswerRe: Reference to undeclared entity 'nbsp' Pin
N a v a n e e t h6-Mar-09 17:40
N a v a n e e t h6-Mar-09 17:40 
GeneralRe: Reference to undeclared entity 'nbsp' Pin
C. Hariharan6-Mar-09 19:27
C. Hariharan6-Mar-09 19:27 
QuestionClient Server in C# Pin
mrithula86-Mar-09 16:51
mrithula86-Mar-09 16:51 
Hi,
ReceiveFrom() requires the use of Bind() so i included the bind();
now im not getting any error but the string "hello" instead of being displayed on the server it is diaplayed in the client itself and nothing is displayed in the server.Now the server remains open..Please help me with this
//client
   private void Send_Click(object sender, EventArgs e)
        {
           
            Callback();
        }

        private void Callback()
        {
            try
            {
                byte[] data = new byte[1024];
                listBox3.Items.Add("Connecting....");
                IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8000);
                Socket newsock= new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                newsock.Bind(ipep);

                listBox3.Items.Add("Connected");                
               
                data = Encoding.ASCII.GetBytes("hello");
                listBox3.Items.Add("Transmitting...");
                newsock.SendTo(data, data.Length,SocketFlags.None,ipep);//sent hello              
           
                listBox3.Items.Add("Sent...");

                IPEndPoint sender = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8000);
                EndPoint tmpRemote = (EndPoint)sender;

                listBox3.Items.Add("Message received from {0}:");
                listBox3.Items.Add(sender.ToString());

               // newsock.Bind(tmpRemote);
                byte[] data1 = new byte[1024];
                int recv = newsock.ReceiveFrom(data1,ref tmpRemote);
                listBox3.Items.Add(Encoding.ASCII.GetString(data1, 0, recv));
                               
                //listBox3.Items.Add("Stopping client");
                //server.Close();            
               
            }
            catch (Exception e)
            {
                //Console.WriteLine("Error..... " + e.StackTrace);
                MessageBox.Show(e.StackTrace);
               
            }
         
        }
   
    }
       
}

//server
namespace TestServer
{
    public class UdpServer
    {
       
        //int recv;
        public static void Main(string[] args)
        {

            UdpServer us = new UdpServer();
        }
        public UdpServer()
        {
            Thread startServer = new Thread(new ThreadStart(start_server));
            //Start the Thread
            startServer.Start();
            Console.WriteLine("Waiting for a client...");
        }
        public static void start_server()
        {
            byte[] data = new byte[1024];
            IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8000);
            Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            newsock.Bind(ipep);
                       
            while (true)
            {
                IPEndPoint sender = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8000);
                EndPoint tmpRemote = (EndPoint)(sender);
               
                int recv = newsock.ReceiveFrom(data, ref tmpRemote);
                Console.WriteLine("Message received from {0}:", tmpRemote.ToString());
                Console.WriteLine(Encoding.ASCII.GetString(data, 0, recv));//hello is received                    

                byte[] data1 = new byte[1024];
                string ss = "Welcome to the Server";
                data1 = Encoding.ASCII.GetBytes(ss);
                newsock.SendTo(data1, data1.Length, SocketFlags.None, tmpRemote);

                Console.WriteLine("\nSent Acknowledgement");
                // startServer.Start();
            }

        }
    }
}

QuestionHolding a key down Pin
Jay Gatsby6-Mar-09 15:19
Jay Gatsby6-Mar-09 15:19 
AnswerRe: Holding a key down Pin
Xmen Real 6-Mar-09 18:46
professional Xmen Real 6-Mar-09 18:46 
QuestionPost with webclient doesnt work Pin
ika26-Mar-09 12:11
ika26-Mar-09 12:11 
QuestionCreate db and sps with C# Pin
CodingYoshi6-Mar-09 12:05
CodingYoshi6-Mar-09 12:05 
AnswerRe: Create db and sps with C# Pin
ABitSmart6-Mar-09 23:22
ABitSmart6-Mar-09 23:22 
QuestionHow to get the SELECT SCOPE_IDENTITY() - alternative Pin
ziwez06-Mar-09 11:45
ziwez06-Mar-09 11:45 
AnswerRe: How to get the SELECT SCOPE_IDENTITY() - alternative Pin
CodingYoshi6-Mar-09 12:09
CodingYoshi6-Mar-09 12:09 
GeneralRe: How to get the SELECT SCOPE_IDENTITY() - alternative Pin
ziwez06-Mar-09 12:18
ziwez06-Mar-09 12:18 
AnswerRe: How to get the SELECT SCOPE_IDENTITY() - alternative Pin
ziwez06-Mar-09 12:20
ziwez06-Mar-09 12:20 
AnswerRe: How to get the SELECT SCOPE_IDENTITY() - alternative Pin
Ennis Ray Lynch, Jr.6-Mar-09 17:08
Ennis Ray Lynch, Jr.6-Mar-09 17:08 
GeneralRe: How to get the SELECT SCOPE_IDENTITY() - alternative Pin
ziwez06-Mar-09 21:13
ziwez06-Mar-09 21:13 
GeneralRe: How to get the SELECT SCOPE_IDENTITY() - alternative Pin
Ennis Ray Lynch, Jr.7-Mar-09 6:34
Ennis Ray Lynch, Jr.7-Mar-09 6:34 
Questionbindingsource add new rec Pin
ABBASI_RA6-Mar-09 11:09
ABBASI_RA6-Mar-09 11:09 
AnswerRe: bindingsource add new rec Pin
Xmen Real 6-Mar-09 13:21
professional Xmen Real 6-Mar-09 13:21 
GeneralPersonal Tutor wanted to teach C#, Sharepoint Pin
keralaman6-Mar-09 9:41
keralaman6-Mar-09 9:41 
GeneralRe: Personal Tutor wanted to teach C#, Sharepoint Pin
Wes Aday6-Mar-09 10:05
professionalWes Aday6-Mar-09 10:05 
QuestionHow can i write a problem so the webpages comes to me Pin
netJP12L6-Mar-09 8:37
netJP12L6-Mar-09 8:37 

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.