Click here to Skip to main content
15,907,392 members
Home / Discussions / C#
   

C#

 
RantRe: ATM program in consol application Pin
Nagy Vilmos12-Mar-09 6:07
professionalNagy Vilmos12-Mar-09 6:07 
GeneralRe: ATM program in consol application Pin
Luc Pattyn12-Mar-09 6:08
sitebuilderLuc Pattyn12-Mar-09 6:08 
GeneralRe: ATM program in consol application Pin
Nagy Vilmos12-Mar-09 6:19
professionalNagy Vilmos12-Mar-09 6:19 
GeneralRe: ATM program in consol application Pin
Luc Pattyn12-Mar-09 6:41
sitebuilderLuc Pattyn12-Mar-09 6:41 
GeneralMan Down! Pin
Nagy Vilmos12-Mar-09 6:48
professionalNagy Vilmos12-Mar-09 6:48 
GeneralRe: Man Down! Pin
Luc Pattyn12-Mar-09 6:51
sitebuilderLuc Pattyn12-Mar-09 6:51 
GeneralRe: ATM program in consol application Pin
musefan12-Mar-09 6:16
musefan12-Mar-09 6:16 
AnswerRe: ATM program in consol application Pin
musefan12-Mar-09 6:18
musefan12-Mar-09 6:18 
GeneralRe: ATM program in consol application Pin
fred_12-Mar-09 8:02
fred_12-Mar-09 8:02 
AnswerRe: ATM program in consol application Pin
Christian Graus12-Mar-09 10:37
protectorChristian Graus12-Mar-09 10:37 
Questionsocket programing Pin
behzadcp12-Mar-09 5:03
professionalbehzadcp12-Mar-09 5:03 
AnswerRe: socket programing Pin
Teuz12-Mar-09 5:15
Teuz12-Mar-09 5:15 
AnswerRe: socket programing Pin
Michael Bookatz12-Mar-09 5:18
Michael Bookatz12-Mar-09 5:18 
AnswerRe: socket programing Pin
Xmen Real 12-Mar-09 5:19
professional Xmen Real 12-Mar-09 5:19 
AnswerRe: socket programing Pin
Member 349379912-Mar-09 6:30
Member 349379912-Mar-09 6:30 
QuestionRe: socket programing Pin
ky_rerun12-Mar-09 6:56
ky_rerun12-Mar-09 6:56 
AnswerRe: socket programing Pin
behzadcp12-Mar-09 7:47
professionalbehzadcp12-Mar-09 7:47 
QuestionXML Pin
mrithula812-Mar-09 4:50
mrithula812-Mar-09 4:50 
AnswerRe: XML [modified] Pin
harold aptroot12-Mar-09 5:03
harold aptroot12-Mar-09 5:03 
GeneralRe: XML Pin
mrithula813-Mar-09 0:16
mrithula813-Mar-09 0:16 
GeneralRe: XML Pin
mrithula813-Mar-09 5:40
mrithula813-Mar-09 5:40 
Hi I tried with the following code.There is no error at the compilation time but something goes wrong at the run time.I do not know how to retrieve the ip and port from the xml..Please help me with this
public static void start_server()
        {
            XmlTextReader r1 = new XmlTextReader("p1.xml");
            XmlDocument doc1 = new XmlDocument();
            doc1.Load(r1);
            int ipadd = r1.ReadElementContentAsInt();
            int ports = r1.ReadElementContentAsInt();
            IPEndPoint ipep = new IPEndPoint(ipadd, ports);

            Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            newsock.Bind(ipep);
            Console.WriteLine("Waiting for a client...");
            while (true)
            {
                try
                {
                    byte[] data = new byte[1024];
                    Console.WriteLine("hai");
                    int recv = newsock.ReceiveFrom(data, 0, data.Length, SocketFlags.None, ref tmpRemote);
                    Console.WriteLine("gfgjfk");
                    Console.WriteLine("Message received from {0}:", tmpRemote.ToString());
                    Console.WriteLine(Encoding.ASCII.GetString(data, 0, recv));//hello is received  

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


                    Console.WriteLine("\nSent Acknowledgement");
                }
                catch (SocketException e)
                {
                    Console.WriteLine(e.Message);
                }
             }
        }

GeneralRe: XML Pin
harold aptroot13-Mar-09 5:50
harold aptroot13-Mar-09 5:50 
GeneralRe: XML Pin
mrithula813-Mar-09 6:57
mrithula813-Mar-09 6:57 
GeneralRe: XML Pin
harold aptroot13-Mar-09 7:33
harold aptroot13-Mar-09 7:33 
AnswerRe: XML Pin
Michael Bookatz12-Mar-09 5:17
Michael Bookatz12-Mar-09 5:17 

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.