Einzelnen Beitrag anzeigen

Benutzerbild von Pseudemys Nelsoni
Pseudemys Nelsoni

Registriert seit: 24. Dez 2002
Ort: Hamburg-Harburg
3.551 Beiträge
 
#1

0 Fehler unter MSVC#, 2 Fehler unter Mono @Linux

  Alt 10. Mär 2006, 12:43
Moin,

folgendes lässt sich unter windows(msvc#) problemlos kompilieren:

Code:
using System;
//using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
 
namespace iSM
{
    class Program
    {
        struct EventUser
        {
            internal string Nickname;
            internal string Username;
            internal string Hostname;
        }
 
        static void Main(string[] args)
        {
            TcpClient tcpClient = new TcpClient();
            string sMainBuf = "";
 
            tcpClient.Connect("irc.ham.de.euirc.net", 6667);
 
            SendText(ref tcpClient, "USER 1 2 3 :4");
            SendText(ref tcpClient, "NICK asdffdsa");
 
            while(tcpClient.Connected)
            {
                byte[] baBuffer = new byte[512];
                string sRawCmd, sPrefix, sCmd, sParams;
                EventUser User;
 
                tcpClient.Client.Receive(baBuffer);
 
                sMainBuf = sMainBuf + System.Text.ASCIIEncoding.Default.GetString(baBuffer);
 
                sMainBuf.Replace("\r", "\n");
                sMainBuf.Replace("\n\n", "\n");
 
                while(sMainBuf.IndexOf('\n') > -1)
                {
                    sRawCmd = sMainBuf.Substring(0, sMainBuf.IndexOf('\n')-1);
                    sMainBuf.Remove(0, sMainBuf.IndexOf('\n'));
 
                    Console.WriteLine(sRawCmd);
 
                    if(sRawCmd.Length > 0)
                    {
 
                        if(sRawCmd[0] == ':')

                        {
                            sPrefix = sRawCmd.Substring(0, sRawCmd.IndexOf(' ')-1);
                            sRawCmd.Remove(0, sRawCmd.IndexOf(' '));
 
                            int iHostPrePos = sPrefix.IndexOf('@');
 
                            if(iHostPrePos > -1)
                            {
                                User.Hostname = sPrefix.Substring(iHostPrePos, sPrefix.Length - iHostPrePos);
                                sPrefix.Remove(iHostPrePos, sPrefix.Length - iHostPrePos);
                            }
 
                            int iUserPrePos = sPrefix.IndexOf('!');
 
                            if(iUserPrePos > -1)
                            {
                                User.Username = sPrefix.Substring(iUserPrePos, sPrefix.Length - iUserPrePos);
                                sPrefix.Remove(iUserPrePos, sPrefix.Length - iUserPrePos);
                            }
 
                            User.Nickname = sPrefix;
 
 
                        }
                    }
                }
            }
        }
 
        static void SendText(ref TcpClient tcpClient, string Text)
        {
            if (tcpClient != null)
                tcpClient.Client.Send(System.Text.ASCIIEncoding.Default.GetBytes(Text+"\r\n"));
        }
 
    }
}

In Linux unter Mono bekomme ich folgendes Fehler:

Zitat:
silent@h76828:~> mcs ism.cs
ism.cs(27) error CS0117: `System.Net.Sockets.TcpClient' does not contain a definition for `Connected'
ism.cs(83) error CS0122: 'Client.get' is inaccessible due to its protection level
Compilation failed: 2 error(s), 0 warnings
Ist doch zum kotzen , dass es eeeeeewig Probleme gibt... wo sind sie hier wieder?
Mario
MSN: cyanide@ccode.de
  Mit Zitat antworten Zitat