Click here to Skip to main content
15,920,603 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to protect my C# program? Pin
PIEBALDconsult15-Feb-09 5:20
mvePIEBALDconsult15-Feb-09 5:20 
QuestionType library exporter error - Urgent help needed Pin
gopisetty14-Feb-09 18:07
gopisetty14-Feb-09 18:07 
AnswerRe: Type library exporter error - Urgent help needed Pin
Dave Kreskowiak15-Feb-09 4:26
mveDave Kreskowiak15-Feb-09 4:26 
AnswerRe: Type library exporter error - Urgent help needed Pin
WolfiKo7-Feb-10 5:36
WolfiKo7-Feb-10 5:36 
GeneralRe: Type library exporter error - Urgent help needed Pin
Jason McBurney11-Jul-11 7:51
Jason McBurney11-Jul-11 7:51 
QuestionPrint a Document Pin
Leo_Mahendra14-Feb-09 17:06
Leo_Mahendra14-Feb-09 17:06 
GeneralRe: Print a Document Pin
Kristian Sixhøj15-Feb-09 1:30
Kristian Sixhøj15-Feb-09 1:30 
Questionwindows forms TCP connection problem Pin
bar300014-Feb-09 12:43
bar300014-Feb-09 12:43 
Hi, I built a checkers game in C# in which players sitting next to each other can play. I am now trying to upgrade it, to become internet based. I want to generate a simple P2P connection. I wrote this code to see if a connection is established but for some reason it freezes when pressing the connection button. Please help me sort this out.
Or if you think this code is unsuitable, than please help me out with this..
here is the code
        string clientOrServer;
        Stream _stream;
        string read;
            Stream getTcpStream()
            {
            TcpClient client;
            IPEndPoint meetingPoint = new IPEndPoint(IPAddress.Parse("79.178.57.135"), 8080);
            if(clientOrServer.ToLower().StartsWith("c"))
                {
                    client = new TcpClient();
                    client.Connect(meetingPoint);
                }
                else
                {
                    TcpListener listener = new TcpListener(meetingPoint.Port);
                    listener.Start();
                    client=listener.AcceptTcpClient();
                    listener.Stop();
                }
                return client.GetStream();
            }
      
        void clientServerclick(System.Windows.Forms.PictureBox picturebox)
        {
           StreamWriter writer = new StreamWriter(_stream);
           writer.AutoFlush = true;
          if (picturebox == pictureBox89)
          {
              writer.WriteLine("{0}", pictureBox89);
          }
          if (picturebox == pictureBox51)
          {
              writer.WriteLine("{0}", pictureBox51);
          }
        }
        void readclick()
        {
            StreamReader reader = new StreamReader(_stream);
            string a = reader.ReadLine();
            Console.WriteLine(a);
        }

this is the code for client generating connection 
              clientOrServer = "c";
            _stream = getTcpStream();
            Console.WriteLine("Connected");
server
              clientOrServer = "s";
            _stream = getTcpStream();
            Console.WriteLine("Connected");
this runs when a click on a soldier occurs
 clientServerclick(pictureBox);

If this code is off, please guide me on how to accomplish this sort of thing.THANKS Big Grin | :-D Smile | :)
AnswerRe: windows forms TCP connection problem Pin
Calin Tatar14-Feb-09 13:12
Calin Tatar14-Feb-09 13:12 
GeneralRe: windows forms TCP connection problem Pin
bar300014-Feb-09 13:21
bar300014-Feb-09 13:21 
GeneralRe: windows forms TCP connection problem Pin
Calin Tatar14-Feb-09 13:26
Calin Tatar14-Feb-09 13:26 
GeneralRe: windows forms TCP connection problem Pin
bar300015-Feb-09 4:37
bar300015-Feb-09 4:37 
GeneralRe: windows forms TCP connection problem Pin
riced15-Feb-09 5:14
riced15-Feb-09 5:14 
GeneralRe: windows forms TCP connection problem Pin
bar300015-Feb-09 22:56
bar300015-Feb-09 22:56 
Questioninstanciate a FileHelperEngine Question Pin
Member 317070314-Feb-09 12:09
Member 317070314-Feb-09 12:09 
AnswerRe: instanciate a FileHelperEngine Question Pin
DaveyM6914-Feb-09 13:04
professionalDaveyM6914-Feb-09 13:04 
General[Message Deleted] Pin
Member 317070314-Feb-09 13:33
Member 317070314-Feb-09 13:33 
GeneralRe: instanciate a FileHelperEngine Question Pin
DaveyM6914-Feb-09 22:18
professionalDaveyM6914-Feb-09 22:18 
QuestionReading A Specific value From Txt File Pin
wwwxyz14-Feb-09 8:53
wwwxyz14-Feb-09 8:53 
AnswerRe: Reading A Specific value From Txt File Pin
Wendelius14-Feb-09 9:11
mentorWendelius14-Feb-09 9:11 
AnswerRe: Reading A Specific value From Txt File Pin
Calin Tatar14-Feb-09 9:14
Calin Tatar14-Feb-09 9:14 
AnswerRe: Reading A Specific value From Txt File Pin
Nuri Ismail14-Feb-09 9:18
Nuri Ismail14-Feb-09 9:18 
GeneralRe: Reading A Specific value From Txt File Pin
wwwxyz14-Feb-09 9:28
wwwxyz14-Feb-09 9:28 
GeneralRe: Reading A Specific value From Txt File Pin
Deresen14-Feb-09 11:01
Deresen14-Feb-09 11:01 
AnswerRe: Reading A Specific value From Txt File Pin
wwwxyz14-Feb-09 11:18
wwwxyz14-Feb-09 11:18 

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.