Click here to Skip to main content
15,900,818 members
Home / Discussions / C#
   

C#

 
GeneralRe: managing multiple socket connections !? Pin
Ravadre1-May-09 4:54
Ravadre1-May-09 4:54 
GeneralRe: managing multiple socket connections !? Pin
rareseu1-May-09 5:19
rareseu1-May-09 5:19 
QuestionHow to check files exists *.xml Pin
Hema Bairavan1-May-09 2:53
Hema Bairavan1-May-09 2:53 
AnswerRe: How to check files exists *.xml Pin
Jimmanuel1-May-09 3:13
Jimmanuel1-May-09 3:13 
GeneralRe: How to check files exists *.xml Pin
Hema Bairavan1-May-09 3:22
Hema Bairavan1-May-09 3:22 
GeneralRe: How to check files exists *.xml Pin
Jimmanuel1-May-09 3:29
Jimmanuel1-May-09 3:29 
GeneralRe: How to check files exists *.xml Pin
Hema Bairavan1-May-09 3:31
Hema Bairavan1-May-09 3:31 
GeneralRe: How to check files exists *.xml Pin
Jimmanuel1-May-09 3:35
Jimmanuel1-May-09 3:35 
Questionrunning an application through network Pin
Genius.Boy1-May-09 2:31
Genius.Boy1-May-09 2:31 
AnswerRe: running an application through network Pin
Nagy Vilmos1-May-09 3:53
professionalNagy Vilmos1-May-09 3:53 
AnswerRe: running an application through network Pin
Dave Kreskowiak1-May-09 4:02
mveDave Kreskowiak1-May-09 4:02 
QuestionProblem with appconfig while uninstalling project Pin
Narendra Reddy Vajrala1-May-09 2:09
Narendra Reddy Vajrala1-May-09 2:09 
AnswerRe: Problem with appconfig while uninstalling project Pin
Mycroft Holmes1-May-09 2:24
professionalMycroft Holmes1-May-09 2:24 
GeneralRe: Problem with appconfig while uninstalling project Pin
Narendra Reddy Vajrala1-May-09 2:40
Narendra Reddy Vajrala1-May-09 2:40 
QuestionMULTI PROCESS Pin
KALAMN1-May-09 2:06
KALAMN1-May-09 2:06 
AnswerRe: MULTI PROCESS Pin
Genius.Boy1-May-09 2:08
Genius.Boy1-May-09 2:08 
AnswerRe: MULTI PROCESS Pin
Eddy Vluggen1-May-09 2:44
professionalEddy Vluggen1-May-09 2:44 
QuestionSocket comunication problem Pin
rareseu1-May-09 0:29
rareseu1-May-09 0:29 
Hy guys ! i've been trying to write up classes for a server and a client using sockets, i'm having a bit of a problem with the server : whenever i try to read incoming messages or send messages i get "Object reference not set to an instance of an object" error, this is because my streamWriter/Reader is null. My problem is that i can't figure out why they are null!? when i instance them there are no problems, but when i invoke their mothods they're null Hmmm | :| , does anybody have any ideeas ?

some code snippets might help to clear this up :

the declarations :

class Server
   {
       private TcpListener listner;

       private Socket socketForClients;

       private System.IO.StreamReader messageReader;
       private System.IO.StreamWriter messageWriter;


the instantianion :


public void startSever()
        {
            
           // listenning for incoming connections
            listner.Start();
          
           //create the socket for the clients
            socketForClients = listner.AcceptSocket();
       
            if (socketPentruClienti.Connected == true)
            {
                try
                {
                    NetworkStream networkStream = new NetworkStream(socketForClients);
                    System.IO.StreamWriter messageWriter = new System.IO.StreamWriter(networkStream);
                    System.IO.StreamReader messageReader = new System.IO.StreamReader(networkStream);
                }
                catch (Exception eNetworkStream)
                {
                    System.Windows.Forms.MessageBox.Show("EROARE : eroare la network stream\nEXCEPTIE : "+eNetworkStream.Message);
                }// try/catch

            }// if connected

        }//startServer


the invoking :

public void write(string message)
        {
            try
            {
                messageWriter.WriteLine(message);
                messageWriter.Flush();
            }
            catch (Exception eScriere)
            {
                System.Windows.Forms.MessageBox.Show("EROARE : serverul nu a putut trimite mesaj\nEXCEPTIE : " + eScriere.Message);
                return;
            }
        }//write


PS : some of the text is in romanian but it's nothing important
AnswerRe: Socket comunication problem Pin
Henry Minute1-May-09 0:55
Henry Minute1-May-09 0:55 
GeneralRe: Socket comunication problem Pin
rareseu1-May-09 1:26
rareseu1-May-09 1:26 
QuestionHow to add one button onto a winForm with code in the design environment Pin
mctramp1681-May-09 0:16
mctramp1681-May-09 0:16 
AnswerRe: How to add one button onto a winForm with code in the design environment Pin
DaveyM691-May-09 0:28
professionalDaveyM691-May-09 0:28 
GeneralRe: How to add one button onto a winForm with code in the design environment Pin
mctramp1681-May-09 1:13
mctramp1681-May-09 1:13 
GeneralRe: How to add one button onto a winForm with code in the design environment Pin
Henry Minute1-May-09 1:21
Henry Minute1-May-09 1:21 
GeneralRe: How to add one button onto a winForm with code in the design environment Pin
mctramp1681-May-09 2:46
mctramp1681-May-09 2:46 

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.