dotgnu-libs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-libs-commits] CVS: dotgnu-base/DotGNU/Net/Sockets NetworkStream.


From: Peter Minten <address@hidden>
Subject: [Dotgnu-libs-commits] CVS: dotgnu-base/DotGNU/Net/Sockets NetworkStream.cs,1.2,1.3 Socket.cs,1.2,1.3
Date: Sun, 28 Jul 2002 11:56:36 -0400

Update of /cvsroot/dotgnu-libs/dotgnu-base/DotGNU/Net/Sockets
In directory subversions:/tmp/cvs-serv4858/DotGNU/Net/Sockets

Modified Files:
        NetworkStream.cs Socket.cs 
Log Message:
Fixed bugs, implemented standard build system.


Index: NetworkStream.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/dotgnu-base/DotGNU/Net/Sockets/NetworkStream.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** NetworkStream.cs    27 Jul 2002 10:36:01 -0000      1.2
--- NetworkStream.cs    28 Jul 2002 15:56:34 -0000      1.3
***************
*** 7,11 ****
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU Lesser General Public License as published by
!  * the Free Software Foundation; either version 2 of the License, or
   * (at your option) any later version.
   *
--- 7,11 ----
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU Lesser General Public License as published by
!  * the Free Software Foundation; either version 2.1 of the License, or
   * (at your option) any later version.
   *
***************
*** 44,48 ****
        /// <param name="port">The port to connect to.</param>
        public NetworkStream(IPAddress address, int port)
!               : base (this.connectSocket(address, port)) {}
        
        //DotGNU Stuff
--- 44,48 ----
        /// <param name="port">The port to connect to.</param>
        public NetworkStream(IPAddress address, int port)
!               : base (NetworkStream.connectSocket(address, port)) {}
        
        //DotGNU Stuff
***************
*** 59,63 ****
        public void Read (String buffer)
        {
!               return Stream.Read(this, buffer);
        }
        
--- 59,64 ----
        public void Read (String buffer)
        {
!               Stream.Read(this, buffer);
!               return;
        }
        
***************
*** 68,72 ****
        public void Read (String buffer, Encoding encoding)
        {
!               return Stream.Read(this, buffer, encoding);
        }
  
--- 69,74 ----
        public void Read (String buffer, Encoding encoding)
        {
!               Stream.Read(this, buffer, encoding);
!               return;
        }
  
***************
*** 76,80 ****
        public void Write(String buffer)
        {
!               return Stream.Write(this, buffer);
        }
  
--- 78,83 ----
        public void Write(String buffer)
        {
!               Stream.Write(this, buffer);
!               return;
        }
  
***************
*** 85,89 ****
        public void Write(String buffer, Encoding encoding)
        {
!               return Stream.Write(this, buffer, encoding);
        }
  
--- 88,93 ----
        public void Write(String buffer, Encoding encoding)
        {
!               Stream.Write(this, buffer, encoding);
!               return;
        }
  
***************
*** 98,101 ****
--- 102,106 ----
        {
                a.Read(b, 0, b.Length);
+               return null;
        }
                                  
***************
*** 106,110 ****
        public static Stream operator>> (System.IO.Stream a, String b)
        {
!               Read(a, b);
        }
        
--- 111,116 ----
        public static Stream operator>> (System.IO.Stream a, String b)
        {
!               Stream.Read(a, b);
!               return null;
        }
        
***************
*** 115,118 ****
--- 121,125 ----
        {
                a.Write(b, 0, b.Length);
+               return null;
        }
  
***************
*** 122,126 ****
        public static Stream operator<< (System.IO.Stream a, String b)
        {
!               Write(a, b);
        }        
  
--- 129,134 ----
        public static Stream operator<< (System.IO.Stream a, String b)
        {
!               Stream.Write(a, b);
!               return null;
        }        
  
***************
*** 131,134 ****
--- 139,143 ----
                DotGNU.Net.Sockets.Socket returnval = new 
DotGNU.Net.Sockets.Socket();
                returnval.Connect(new IPEndPoint(address, port));
+               return returnval;
        }
        

Index: Socket.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/dotgnu-base/DotGNU/Net/Sockets/Socket.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Socket.cs   27 Jul 2002 10:36:01 -0000      1.2
--- Socket.cs   28 Jul 2002 15:56:34 -0000      1.3
***************
*** 6,10 ****
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU Lesser General Public License as published by
!  * the Free Software Foundation; either version 2 of the License, or
   * (at your option) any later version.
   *
--- 6,10 ----
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU Lesser General Public License as published by
!  * the Free Software Foundation; either version 2.1 of the License, or
   * (at your option) any later version.
   *
***************
*** 35,44 ****
        //Constructor using the TCP/IP settings
        public Socket()
!               : this(AddressFamily.InterNetwork, SocketType.Stream, 
ProtocolType.Tcp);
        
        //Easy Bind methods
        public void Bind(String address, int port)
        {
!               Bind(new IPEndPoint(address, port));
        }
  
--- 35,44 ----
        //Constructor using the TCP/IP settings
        public Socket()
!               : base(AddressFamily.InterNetwork, SocketType.Stream, 
ProtocolType.Tcp);
        
        //Easy Bind methods
        public void Bind(String address, int port)
        {
!               Bind(new IPEndPoint(IPAddress.Parse(address), port));
        }
  
***************
*** 51,55 ****
        public void Connect(String address, int port)
        {
!               Connect(new IPEndPoint(address, port));
        }
  
--- 51,55 ----
        public void Connect(String address, int port)
        {
!               Connect(new IPEndPoint(IPAddress.Parse(address), port));
        }
  
***************
*** 65,79 ****
        public void Receive(String buffer)
        {
!               return Receive(UnicodeEncoding.GetBytes(buffer), 
SocketFlags.None);
        }
  
        public void Receive(String buffer, SocketFlags socketFlags)
        {
!               return Receive(UnicodeEncoding.GetBytes(buffer), socketFlags);
        }
  
        public void Receive(String buffer, Encoding encoding)
        {
!               return Receive(buffer, encoding, SocketFlags.None);
        }
  
--- 65,82 ----
        public void Receive(String buffer)
        {
!               Receive(buffer, Encoding.Unicode, SocketFlags.None);
!               return;
        }
  
        public void Receive(String buffer, SocketFlags socketFlags)
        {
!               Receive(buffer, Encoding.Unicode, socketFlags);
!               return;
        }
  
        public void Receive(String buffer, Encoding encoding)
        {
!               Receive(buffer, encoding, SocketFlags.None);
!               return;
        }
  
***************
*** 84,104 ****
                byte[] bbuf = new byte[1024]; //Read 1024 at a time
                char[] cbuf = new char[514]; //Stay on the safe side with size 
estimations
                String tbuffer;
  
                do
                {
!                       int bytesreceived = Receive(bbuf, socketFlags);
  
!                       encoding.GetChars(bbuf, 0, bytesread, cbuf, 0);
!                                       break;
  
                        tbuffer = new String(cbuf);
  
!                       tbuffer = tbuffer.SubString(0, charsread); //Cut off 
useless chars
  
                        buffer += tbuffer;
  
                        if (bytesreceived < 1024)
!                               return buffer;
  
                } while (true); //Infinite loop if it wasn't for that return 
statement
--- 87,107 ----
                byte[] bbuf = new byte[1024]; //Read 1024 at a time
                char[] cbuf = new char[514]; //Stay on the safe side with size 
estimations
+               int charsread;
                String tbuffer;
  
                do
                {
!                       int bytesreceived = Receive(bbuf, 0, bbuf.Length, 
socketFlags);
  
!                       charsread = encoding.GetChars(bbuf, 0, bytesreceived, 
cbuf, 0);
  
                        tbuffer = new String(cbuf);
  
!                       tbuffer = tbuffer.Substring(0, charsread); //Cut off 
useless chars
  
                        buffer += tbuffer;
  
                        if (bytesreceived < 1024)
!                               return;
  
                } while (true); //Infinite loop if it wasn't for that return 
statement
***************
*** 108,129 ****
        public void Send(String buffer)
        {
!               return Send(UnicodeEncoding.GetBytes(buffer), SocketFlags.None);
        }
  
        public void Send(String buffer, SocketFlags socketFlags)
        {
!               return Send(UnicodeEncoding.GetBytes(buffer), socketFlags);
        }
  
        public void Send(String buffer, Encoding encoding)
        {
!               return Send(buffer, encoding, SocketFlags.None);
        }
  
        public void Send(String buffer, Encoding encoding, SocketFlags 
socketFlags)
        {
!               return Send(encoding.GetBytes(buffer), socketFlags);
        }
  
        //Custom eventhandler
        public delegate void SocketEventHandler(Socket subject);
--- 111,140 ----
        public void Send(String buffer)
        {
!               Send(Encoding.Unicode.GetBytes(buffer), SocketFlags.None);
!               return;
        }
  
        public void Send(String buffer, SocketFlags socketFlags)
        {
!               Send(Encoding.Unicode.GetBytes(buffer), socketFlags);
!               return;
        }
  
        public void Send(String buffer, Encoding encoding)
        {
!               Send(buffer, encoding, SocketFlags.None);
!               return;
        }
  
        public void Send(String buffer, Encoding encoding, SocketFlags 
socketFlags)
        {
!               Send(encoding.GetBytes(buffer), socketFlags);
!               return;
        }
  
+ 
+ //Events are commented out until pnet get's better at threading 
+ //(and some bugs in this code get solved).
+ /* 
        //Custom eventhandler
        public delegate void SocketEventHandler(Socket subject);
***************
*** 225,231 ****
                //Call select with copies of the lists
                //I hope this goes by value
!               nreadlist = readlist;
!               nwritelist = writelist;
!               nerrorlist = errorlist;
  
                Select(readlist, writelist, errorlist, selectwaittime);
--- 236,242 ----
                //Call select with copies of the lists
                //I hope this goes by value
!               IList nreadlist = readlist;
!               IList nwritelist = writelist;
!               IList nerrorlist = errorlist;
  
                Select(readlist, writelist, errorlist, selectwaittime);
***************
*** 247,251 ****
                }
  
!       }
  
        //Overloaded operators
--- 258,262 ----
                }
  
!       } */
  
        //Overloaded operators




reply via email to

[Prev in Thread] Current Thread [Next in Thread]