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

C#

 
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 
GeneralRe: How to add one button onto a winForm with code in the design environment Pin
mmgbmm1-May-09 4:32
mmgbmm1-May-09 4:32 
Question[Message Deleted] Pin
saoda1-May-09 0:03
saoda1-May-09 0:03 
AnswerAnswer! Pin
Nagy Vilmos1-May-09 0:11
professionalNagy Vilmos1-May-09 0:11 
AnswerAnswer Pin
dan!sh 1-May-09 0:12
professional dan!sh 1-May-09 0:12 
AnswerRe: Question! Pin
SimpleData1-May-09 0:19
SimpleData1-May-09 0:19 
QuestionProblem with events code and thread (long post) Pin
Otex30-Apr-09 23:02
Otex30-Apr-09 23:02 
AnswerRe: Problem with events code and thread (long post) Pin
Nicholas Butler1-May-09 0:35
sitebuilderNicholas Butler1-May-09 0:35 
GeneralRe: Problem with events code and thread (long post) Pin
Otex1-May-09 0:48
Otex1-May-09 0:48 
AnswerRe: Problem with events code and thread (long post) Pin
Nicholas Butler1-May-09 5:22
sitebuilderNicholas Butler1-May-09 5:22 
QuestionRe: Problem with events code and thread (long post) Pin
Otex3-May-09 5:43
Otex3-May-09 5:43 

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.