Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET Core port - DO NOT MERGE #175

Closed
wants to merge 5 commits into from
Closed

.NET Core port - DO NOT MERGE #175

wants to merge 5 commits into from

Conversation

@darkl
Copy link
Collaborator

darkl commented May 2, 2016

Hi,

I tried for fun to make this library be .NET Core compatible.

I made a project.json file and made it compile, note that I changed some things: there is no such thing "InvariantCultureIgnoreCase", so I replaced it with "OrdinalIgnoreCase",
there are no more "Close" methods for streams and sockets, so I replaced it with "Dispose".

I also didn't reimplement QueuedStream since I'm not sure if this hack is needed for .NET Core. I also didn't covert the tests.

I didn't try this, I don't know if it works.

I'm opening this pull request, just for the case that anyone wants to continue this work on the port. Please don't merge it until tests are converted, pass, and until this is actually tested.

Best regards,
Elad

@statianzo
Copy link
Owner

statianzo commented May 2, 2016

Slick work.

@AdrianBathurst
Copy link

AdrianBathurst commented May 3, 2016

Thanks!! I'll be needing this port soon, so thank you very much!

@NVentimiglia
Copy link

NVentimiglia commented Jun 27, 2016

+1

DotNetCore/Kestral version of my server dropped to 5k RPS... from an easy 50k.

@NVentimiglia
Copy link

NVentimiglia commented Jul 9, 2016

The dependency NETStandard.Library >= 1.6.0 could not be resolved. Fleck G:\Drive\Avarice\SignalMQ\Fleck-master\core\Fleck\project.json 5

@NVentimiglia
Copy link

NVentimiglia commented Jul 9, 2016

After some fiddling, I got the project down to 4 errors with the following

`
{
"title": "Fleck",
"version": "1.0.0-*",

"dependencies": {
"NETStandard.Library": "1.6.0"
},

"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
},

"buildOptions": {
"allowUnsafe": true, "define": [ "NETCORE" ]
}
}
`

The errors being the removal of the BeginAsync/EndAsync and missing System.Security.SSLStream

Do we have an ETA when this will be ready for testing. I recently got the microsoft websocket up to 800,000 OPS would like to test out fleck again. @darkl

@darkl
Copy link
Collaborator Author

darkl commented Jul 9, 2016

@NVentimiglia, I worked on this a bit today.

This works fine on my machine with .NET Core RTM:

dotnet restore
dotnet build src\Fleck src\Samples\ConsoleApp
cd src\Samples\ConsoleApp
dotnet run

Tests don't compile since a .NET Core compatible Moq isn't available yet.

I'm not sure if I'll finish this, but you're welcome to continue from where I've stopped.

Elad

@NVentimiglia
Copy link

NVentimiglia commented Jul 9, 2016

7/9/2016 12:31:43 PM [Info] Server started at ws://0.0.0.0:5000 (actual port 5000)
One or more errors occurred. (Attempt by method 'Fleck.SocketWrapper.Accept(System.Action1<Fleck.ISocket>, System.Action1<System.Exception>)' to access method 'System.Net.Sockets.Socket.BeginAccept(System.AsyncCallback, System.Object)' failed.)
Terminating

@darkl
Copy link
Collaborator Author

darkl commented Jul 9, 2016

Are you using the latest version? (netcore branch)
The latest version doesn't call BeginAccept at all.

Elad


public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
return _stream.WriteAsync(buffer, offset, count, cancellationToken);

This comment has been minimized.

Copy link
@bilal-fazlani

bilal-fazlani Feb 2, 2017

Shouldn't this be awaited ?


public override Task FlushAsync(CancellationToken cancellationToken)
{
return _stream.FlushAsync(cancellationToken);

This comment has been minimized.

Copy link
@bilal-fazlani

bilal-fazlani Feb 2, 2017

Shouldn't this be awaited ?


public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
{
return _stream.CopyToAsync(destination, bufferSize, cancellationToken);

This comment has been minimized.

Copy link
@bilal-fazlani

bilal-fazlani Feb 2, 2017

Shouldn't this be awaited ?

This comment has been minimized.

Copy link
@statianzo

statianzo Feb 2, 2017

Owner

awaiting would just wrap the CopyToAsync task with another task that does nothing but return the original result. Why do you think it should be wrapped?

This comment has been minimized.

Copy link
@bilal-fazlani

bilal-fazlani Feb 3, 2017

Never really thought of it that way. You are right.

@darkl
Copy link
Collaborator Author

darkl commented Apr 27, 2018

Not needed anymore.

@darkl darkl closed this Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.