Apr 17, 2013 at 3:04 PM
Edited Apr 17, 2013 at 3:11 PM
I'm trying to pass the output of ObservableTcpListener to a Subject<byte>. That subject will then be used in a query.
The problem is that while the ObservableTcpListener receives every socket contents that I send, the query doesn't output anything besides the first two or three events.
This code shows the problem that I'm mentioning. It should be ran in LINQPad as a "C# Program".
// Create the subject and the query
var subject = new Subject<byte>();
var query = subject.Select(reading => reading);
var tcpListenerPool = ObservableTcpListener.Start(IPAddress.Loopback, 20001);
(TcpClient tcpClient) =>
// Debug information just to check if the socket actually has anything in it
Console.WriteLine("tcpSocket.Avaliable: " + tcpClient.Available);
var receiveContentObservable = tcpClient.Client.ReceiveUntilCompleted(SocketFlags.None);
// Send socket content to the subject
// Define other methods and classes here
Note that sometimes LINQPad doesn't correctly close the socket, and gives the error: "Only one usage of each socket address (protocol/network address/port) is normally permitted". If that happens go to the "Query" menu and choose "Cancel
All Threads and Reset".
The program that I'm using to send the sockets to the ObservableTcpListener is this python program:
payload = ["foo", "bar"];
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Send 10 sockets with either "foo" or "bar"
map(lambda x: sendPayload(random.choice(payload)), range(10))
Is this a bug, or am I doing something wrong?
Edit: I'm using the "Rxx Class Library for .NET 4.0" available in the Downloads section.