[Mono-bugs] [Bug 443346] New: Socket.Connected property is incorrect
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Nov 10 07:21:10 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=443346
Summary: Socket.Connected property is incorrect
Product: Mono: Class Libraries
Version: unspecified
Platform: Other
OS/Version: Other
Status: NEW
Severity: Minor
Priority: P5 - None
Component: System
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: alan.mcgovern at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
In the testcase below, MS.NET prints out false/false whereas mono prints out
false/true.
If you comment out the call to BeginSend, MS.NET prints out false/true, though
it should be false/false aswell I think.
-------------------------
using System;
using System.Net;
using System.Net.Sockets;
namespace Test
{
class MainClass
{
public static void Main(string[] args)
{
ConnectionPair pair = new ConnectionPair (12345);
// If you comment this out, you get false/true printed
instead of false/false
pair.Outgoing.EndSend(pair.Outgoing.BeginSend (new
byte[10], 0, 10, SocketFlags.None, null, null));
pair.Incoming.Close ();
try {
pair.Outgoing.EndReceive(pair.Outgoing.BeginReceive (new byte[10], 0, 10,
SocketFlags.None, null, null));
} catch {
}
Console.WriteLine ("Connected? {0} - {1}",
pair.Incoming.Connected, pair.Outgoing.Connected);
}
public class ConnectionPair
{
TcpListener socketListener;
public Socket Incoming;
public Socket Outgoing;
public ConnectionPair(int port)
{
socketListener = new
TcpListener(IPAddress.Loopback, port);
socketListener.Start();
Socket s1a = new
Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
s1a.Connect(IPAddress.Loopback, port);
Socket s1b = socketListener.AcceptSocket();
Incoming = s1a;
Outgoing = s1b;
}
}
}
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list