-
Notifications
You must be signed in to change notification settings - Fork 744
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 3.5 compatibility #98
Comments
Download the source code and try to compile with .net 3.5, I don't think On Fri, Aug 30, 2013 at 2:37 PM, Diego Duclos notifications@github.comwrote:
|
I quickly created a patch which compiles under 3.5 client profile. I think others than compiling under 3.5 client profile, you might check out issue #7 for other open issues regarding mono support. If you worked around those, be sure to submit a pull request ;-) |
Patch applied, it compiles perfectly indeed, I'll be testing it in the next few days as I change my app to use NetMQ instead of clrzmq Thanks! |
I can confirm this looks good after some initial quicktesting with mono 2.6! This is currently on windows, but I'll be testing on linux soon as well and report what I find 👍 Is it worth considering making the code compile under both environments and add preprocessor statements around functionality making heavy use of the 4.0 framework ? |
There are quite a few people wanting to use netmq within Unity3D so I think it's a welcome addition @cncfanatics. |
What is the current status of this? I'm interested in this too - creating a software component that needs to be deployable on .NET 3.5. I'm using compiler pragmas PRE_4 to signal use of pre-.NET 4.0 features, and PRE_5 to signal use of pre-.NET 4.5/C# 5.0 features. Which does give me some gnashing of teeth as I do love using the latest language features! |
I now have a solution for the .NET 3.5 compatibility issue, and am about to submit a request to update. This only targets the Windows side - if it's accepted then I'll also do the Mono side if that is wished. Included in this are some edits to the tests to make them compile/test under 3.5. It was necessary to incorporate a conditional-compilation symbol: "PRE_4", to signal that the project is to be built using only pre- .NET 4.0 features. The Security is included, but I omitted NetMQScheduler since that probably doesn't make much sense under 3.5. I built and tested on a virtual machine which has only VS 2008, and no .NET higher than 3.5. This is my first contribution so any advice would be appreciated. |
I'd personally be a big fan of the mono side. |
Ok - working on that now (I'm between jobs at the moment, lamentably, so I have some time to devote to this right now). Exactly which version of Mono does the current version of Unity require? And - btw, what is the exact command-path that one uses to submit a 'git push' of one's changes? I'm getting various errors as I try different variations of the line under [remote "origin"]. I tried url = ssh://git@github.com/zeromq/netmq.git, and other variations with my user nickname ( JamesWHurst ) at various places within that. None work. |
Unity targets 3.5 features of Mono though it uses a custom build. I'm not exactly sure what the changes they applied are, but I believe that just targeting the 3.5 .net framework should suffice. @JamesWHurst Regarding the push issues you are having, please read: https://help.github.com/articles/fork-a-repo |
I had read that page - those commands are not working for me. Eg, git push results in ERROR: Permission to zeromq/netmq.git denied to JamesWHurst. fatal: Could nto read from remote repository. |
Because you are trying to push to the main repository and not your forked copy. You should fork the main, pull that, make a branch, write your changes, commit / push. Go back to github and a nice little button "pull something something" will show up. |
Ok. I had clicked on the "Fork" button on the github page. I didn't see anything happen. I had pulled that down onto my local drive, put my edits there. So, just now, I created a branch on my local box using git branch Net35CompatFix (the intent was to name the branch Net35CompatFix). Then I entered git checkout Net35CompatFix to move over to that branch. Now, how do you bring this branch up to Github? On the Github page, I created the branch named Net35CompatFix. Do I now need to enter the command: git push --set-upstream origin Net35CompatFix ? Or does that push my edits into the master instead of into my branch? |
James, It seems that you are not familiar with Pull Requests contribution model. I On Tue, Oct 15, 2013 at 10:21 PM, James Hurst notifications@github.comwrote:
|
That is correct. I have used many other version-control systems, but never Git. I have a little book here, "Pragmatic Guide to Git", which doesn't feel like it's quite helping. And that article you list - I'd already read. It explains a few generic concepts, but the specific commands it lists don't seem to work. Nothing seems to be working as it is supposed to. I guess I should have just done a very tiny edit or bug-fix before attempting this, so that I wouldn't have wasted so many days before discovering this is something I cannot use. |
Actually - no. I had already done the Fork, cloned the repo to my desktop cptr, created a branch, and then added and committed my changes to my local branch. And I created a branch on that Github page by the same name - Net35CompatFix, by clicking on the webpage-control. And, I understand how to make a pull-request. It is just the process of pushing my repo from my local machine, up to the branch on the Github repo, that is not happening. At this point it would have been faster to copy it onto a pile of floppy-disks, duck-tape those to the back of a turtle, and send it in the direction of the Github server to be manually unpacked and transferred. This is why I should try to stay away from open-source. |
James... you create the branch on your local fork (on your computer). Regarding your comment on why you stay away from open-source, sad you think that way, but given the hundreds of thousands of people currently working with github, I doubt it's a problem with OSS/git ;) |
Now, the "HTTPS clone url" on the bottom right is the url you should be cloning onto your computer. This is your "personal" version of the repository as you can see from the "JamesWHurst/netmq" project. Make a branch, make your changes, commit and push. Then, from your repository on git, you'll be offered the option to create a pull request to the main repository, which we can then pull in. |
Aha! Thx. So on my local box I entered at a command-line: git clone https://githumb.com/JamesWHurst/netmq.git |
Basically yes, you create a branch on local box, hack on it, commit then push. On a side note, until you get accustomed to using git, you might want to give a git gui tool a try, something like TortoiseGit or SmartGit. (I personally use TortoiseGit as its quite fast and simple to use). |
What exactly is the correct command to push the commits back to my branch on the repo? On my local box, I am "in" branch Net35CompatFix. When I entered "git push", it responds: fatal: The current branch Net35CompatFix has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin Net35CompatFix. |
I believe you'd do: git push -u origin Net35CompatFix the -u will automagically add the upstream for you for future uses, so you'd be able to perform a git push, on successive pushes without being asked for the upstream branch. |
Thank you reiroldan - I appreciate your help. Your recommendation worked splendidly, and the Pull Request is in. I appreciate your helping me through this! jh |
Glad I could help you through that ;) |
Hi, I'd also like to make use of NetMQ in Unity3d. I do not know enough about GitHub yet to know how all this works. If I understand correctly, you can either download tobi-tonsen's patch or JamesWHurst's branch, and you should get NetMQ compatible with .NET 3.5. However, I don't know how to do either of these. (I tried looking around for a while, but I wouldn't know where to begin.) If I download tobi-tonsen's patch, how do I apply it? |
download git from http://git-scm.com/downloads and install git for windows. open command prompt and create a directory for your git repositories. than run "git clone https://github.com/PSG-Sakari/netmq.git" you now have a new directory called NetMQ, open it, open src folder, open On Mon, Jul 7, 2014 at 2:01 PM, Taboen notifications@github.com wrote:
|
Thanks! It worked! Question: how did you know about the existence of the PSG-Sakari fork? Next On Mon, Jul 7, 2014 at 1:15 PM, Doron Somech notifications@github.com
|
I've put in a pull request for it, you can see it under the pull requests Note: I'm planning on updating that fork soon with a more up-to-date way of On Mon, Jul 7, 2014 at 2:19 PM, Taboen notifications@github.com wrote:
|
Just be sure I am getting this. You are requesting to put your changes into Also, if it's yours, you should know I had some problems compiling your
etc etc, for classes ThreadLocal, TaskScheduler, Task, ConcurrentBag, After commenting it, compiling a new version, it works perfectly in Gr, Dirk On Mon, Jul 7, 2014 at 2:20 PM, Diego Duclos notifications@github.com
|
Are you compiling 32bit and .net fill runtime? Can you try and fint out on which method the CreateSocketPublisher is On Mon, Nov 24, 2014 at 9:25 AM, billyhct notifications@github.com wrote:
|
Hi I compile with 64 bit as Apple requires 64 bits next month. I will check which method is blocked Thanks |
I started to play around with Kerbal Space program, a which is powered by Unity3d, and I wanted to take a plugin, namely KSPIo, and convert it to using some kind of messaging. Naturally mono doesn't support Win32 named pipes, so I thought I'd try netmq. I downloaded the zip file from here, and loaded it into Visual Studio 2013, and built the .net 3.5 version. It 'builds' in under a second so I wonder if it's really compiling anything.... Anyways as a simple test, I setup two small projects in VS 2013, a client/server to verify that they work with .net 3.5 ... Server: namespace HelloWorldDemo Client: namespace HelloWorldDemo And these work as I'd expect. So now the fun part, I paste the client portion into the existing plugin, on it's awake method, and I get this nice crash... [EXC 12:41:29.332] FormatException: Invalid format for Guid.Guid(string). System.Guid+GuidParser.ParseChar (Char c) System.Guid+GuidParser.ParseGuid2 () System.Guid+GuidParser.Parse () System.Guid..ctor (System.String g) AsyncIO.Windows.UnsafeMethods..cctor () Rethrow as TypeInitializationException: An exception was thrown by the type initializer for AsyncIO.Windows.UnsafeMethods AsyncIO.CompletionPort.Create () NetMQ.zmq.Utils.Proactor..ctor (System.String name) NetMQ.zmq.IOThread..ctor (NetMQ.zmq.Ctx ctx, Int32 threadId) NetMQ.zmq.Ctx.CreateSocket (ZmqSocketType type) NetMQ.NetMQContext.CreateHandle (ZmqSocketType socketType) NetMQ.NetMQContext.CreateRequestSocket () KSPSerialIO.SettingsNStuff.Awake ()Obviously I'm doing something wrong. |
You are actually doing ok, NetMQ is using AsyncIO, which uses guid in a way and compile netmq.unity On Sat, Jan 3, 2015 at 6:50 AM, neozeed notifications@github.com wrote:
|
Wow that did it! I'm now exporting my telemetry data from my rocket! This is totally awesome! I don't know why, but i had to manually add the project NetMQ.Unity to the master project, but again it compiles in 1 second, and works! Thank you so much for your help!!!! |
for later visitors looking for a unity compatible version: by now it works with the .net3.5 project in the master branch, no need to resort to somdoron's previous pull request. (working for win, osx and ios export). |
Try version 3.3.0.12-rc1, or to build from source. On Wed, Apr 8, 2015 at 6:40 PM, Jonas Trottnow notifications@github.com
|
When I use ZeroMQ at Android, the app crashes a lot. I use the version 3.3.0.12-rc1 and Unit 5.1.0F3. It does not show any exception. |
Try to compile from master, also try to run following line at the beginning ForceDotNet.Force(); On Tue, Jun 23, 2015 at 5:56 PM, Flime notifications@github.com wrote:
|
Also if it still doesn't work, try to compile NetMQ with AsyncIO.Unity from https://github.com/somdoron/AsyncIO/tree/master/Source/AsyncIO On Fri, Jun 26, 2015 at 9:11 AM, Doron Somech somdoron@gmail.com wrote:
|
It does work. (Tried it with building AsyncIO for unity and compiling NetMQ.) Only after a few minutes it stops working. I need to reopen my unity android app to let it start working again. Also adding ForceDotNet.Force(); does not have any effect at the unity editor. It will crash every time I start the playing for the second time. (Only in Unity Editor). |
Hey guys, I've been happily working with this build of NetMQ for Unity both in OS X and Windows. But I've been doing all my testing using the loop back 127.0.0.1. As soon as I moved the server (a Pyzmq server) to another machine I get no connection, at least nothing that sends and receives data. I'm using tcp://*:5555 as the bind address on the server and tcp://theServerMachineIP:5555 on the client. When I look at windows netstat on the server box it actually shows an active connection with the client binding to 5555 but connecting to some random port on the client (which I'm assuming is normal) but my code is unresponsive in terms of sending and receiving data. No the machines firewalls are off and I've even explicitly set rules to allow port 5555 through, but no joy. Even tried connecting to a different router in case that was the issue. Any ideas? So weird that it works fine on the same machine using the loopback. Incredibly frustrating after having spent weeks building up the code on a local box and everything testify fine:( |
Can you telnet to port 5555 between the boxes? That's a good test to rule On Sun, 9 Aug 2015 at 16:57 pixerati notifications@github.com wrote:
|
I did a raw telnet through to port 5555 without any issue. Could send commands from client box and receive back from server box. |
Hey guys, if anyone is still troubled by this, you have to manually dispose of any sockets and contexts at unity's app quit like:
That stops unity from freezing on the second start of the game. |
@pixerati I'm running into the same problem. Running PyZmq server on localhost, 2 clients can connect to the host and directly to each other just fine via bindRandom ports. Moving the server or either client to another machine still lets the connection form but no messages make their way through. I'm running the latest AsyncIO3.5 code, the latest NetMQ code, Unity 5.2.1 and Windows 10. Network issues have been ruled out by using lightweight PyZmq and NetMq servers/clients to simulate a similar environment. Also, if one of the sockets times out whilst sending (rather than blocking forever) then disposing the sockets and context at the end will still hard freeze Unity. I suspect that the busted socket is still being held by a thread somewhere. |
Hi guys. |
I will give it a try today. Which unity version are you using? On Thu, Oct 22, 2015 at 12:15 PM, LewisBridgeman notifications@github.com
|
Thanks. I'm currently using 5.2.1. I'll upgrade to 5.2.2 quickly, just in case that changes anything. |
Can you also upload somewhere a project that get freeze? I have little On Thu, Oct 22, 2015 at 12:26 PM, LewisBridgeman notifications@github.com
|
Lewis, the most success I've had is with the latest branch of NetMQ using This got me to the point where a very simple Unity project could On Thu, Oct 22, 2015 at 10:16 PM LewisBridgeman notifications@github.com
|
Thanks both. Mystfit, I'll try doing that. Somdoron, I'll upload my Unity project after I've tried Mystfits advice. |
I tried your method, but it doesn't seem to work for me. It might be that I'm misunderstanding how to use NetMQ in Unity, so I've attached the script that freezes.
My API compatibility level is set to ".Net 2.0" rather than ".Net 2.0 Subset" |
@LewisBridgeman I don't know much about Unity, but the coroutine (C# generator function) has one problem in that the |
@drewnoakes Thanks, you were right! |
I've got the problem that @dragosbulugean and @Flime wrote about. The following code freezes Unity when I start the game in the editor for the second time: using UnityEngine;
using NetMQ.Sockets;
public class PosResetter : MonoBehaviour
{
SubscriberSocket subSocket = null;
void Start ()
{
Debug.Log("Starting up NetMQ interface");
subSocket = new SubscriberSocket();
}
void OnApplicationQuit()
{
subSocket.Dispose();
}
} I'm using the following:
Do I have to build something in a specific way? It seems as if the SubscriberSocket is not being released after OnApplicationQuit. On the second startup this let's Unity freeze. But that's just a blind guess... |
I've probably been able to fix the above mentioned issue myself with the following code: using UnityEngine;
using NetMQ;
using NetMQ.Sockets;
public class PosResetter : MonoBehaviour
{
NetMQContext context = null;
SubscriberSocket subSocket = null;
void Start ()
{
Debug.Log("Starting up NetMQ interface");
context = NetMQContext.Create();
subSocket = context.CreateSubscriberSocket();
}
void OnApplicationQuit()
{
Debug.Log("Shutting down...");
subSocket.Close();
context.Terminate();
Debug.Log("Done...");
}
} Looks like it is somehow related to issue #424. Due to the missing context it is not possible to clean up completely. By explicitly terminating it works as expected and Unity does not freeze on second start. |
I write games using Unity 3D.
Unity 3D uses mono to run managed code, while the engine itself is written in another language.
This means all extra programming happens using mono. Unfortunatly, it's a rather outdated version of mono that doesn't have any of the features of .NET 4.0.
NetMQ refuses to run on it, is it possible to fix this ?
(I could possibly do this myself with some guidance on how to do this)
The text was updated successfully, but these errors were encountered: