> Email-style angle brackets
> are used for blockquotes.
> > And, they can be nested.
> #### Headers in blockquotes
>
> * You can quote a list.
> * Etc.
Horizontal Rules
Three or more dashes or asterisks:
---
* * *
- - - -
Manual Line Breaks
End a line with two or more spaces:
Roses are red,
Violets are blue.
Fenced Code Blocks
Code blocks delimited by 3 or more backticks or tildas:
```
This is a preformatted
code block
```
Header IDs
Set the id of headings with {#<id>} at end of heading line:
## My Heading {#myheading}
Tables
Fruit |Color
---------|----------
Apples |Red
Pears |Green
Bananas |Yellow
Definition Lists
Term 1
: Definition 1
Term 2
: Definition 2
Footnotes
Body text with a footnote [^1]
[^1]: Footnote text here
Abbreviations
MDD <- will have title
*[MDD]: MarkdownDeep
FUTURE POSTS
Querying over the current time in RavenDB - 2 hours from now
There are posts all the way to Oct 11, 2024
RECENT SERIES
Challenge
(75): 01 Jul 2024 - Efficient snapshotable state
Recording
(14): 19 Jun 2024 - Building a Database Engine in C# & .NET
Comments
Race condition between creating the TcpListener and starting it and multiple threads calling this code at the same time.
Solution: lock around new TcpListener and tcpListener.Start().
RAGE... I hate when people do find available port by iterating and catching exceptions. The correct way to do this is:
listener = new TcpListener(IPAddress.Loopback, 0); //
RTFMMSDN listener.Start(); port = ((IPEndPoint)listener.LocalEndpoint).Port;Let the OS do it's work.
@hazzik wow, goes to say that sometimes RTFM is the best answer :-).
Try run this code: https://gist.github.com/hazzik/edd28a7129f820b4579b
How many exceptions!?! Zero.
I got six exception when I ran it with Linqpad
An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full [Source = Worker Thread]
Giorgi they are all unrelated to the problem, it is just because it tries to spawn 1000 threads
@hazzik the nuance is that the proxy is trying to create a listener within a known range: 1 - port AFAIK, you do not have this when using 0 as a port
Signature of the constructor is different between stack and code. You're running old code?
You have another constructor ProxyServer(int port, int to) that do not catch SocketException?
As Jahmai points out the stacktrace shows ProxyServer..ctor(Int32 from, Int32 to) and not ProxyServer..ctor(Int32& from, Int32 to).
Jahmai, DING DING DING, yes, that is the issue
Comment preview