Note that there are some explanatory texts on larger screens.

plurals
  1. POBuilding zeromq helloworld example with command line mono
    primarykey
    data
    text
    <p>I am trying to build a helloworld example for zeromq using the C# binding. I have succesfully built the .Net library (clrzmq.dll). I am trying to build the single csharp source, form the command line, using the csharp compiler that comes with mono.</p> <p>I have included the contents of the source file below:</p> <pre><code>using System; using System.Collections.Generic; using System.Threading; using System.Text; /** * Author: Randy Dryburgh * Email: me@rwd.im * License: This example code licensed under the MIT/X11 license. */ namespace Examples { class hwserver { static void Main(string[] args) { // allocate a buffer byte[] zmq_buffer = new byte[1024]; // Prepare our context and socket ZMQ.Context context = new ZMQ.Context(1); ZMQ.Socket socket = context.Socket(ZMQ.REP); socket.Bind("tcp://*:5555"); while (true) { try { // Wait for next request from client socket.Recv(out zmq_buffer); string request = Encoding.ASCII.GetString(zmq_buffer); // log that we got one Console.WriteLine("Received request: [%s]", request); // Do some 'work' Thread.Sleep(1); // Send reply back to client socket.Send(Encoding.ASCII.GetBytes("World".ToCharArray())); } catch (ZMQ.Exception z) { // report the exception Console.WriteLine("ZMQ Exception occurred : {0}", z.Message); } } } } } </code></pre> <p>Here is the command line command I use and the error message I get.</p> <pre><code>oompah@localhost:~/work/dev/c++/3rdparty/zeromq/zguide/examples/C#$ mcs hwserver.cs.v1 -lib:/home/oompah/work/dev/c++/3rdparty/zeromq/clrzmq2/clrzmq/bin/Release/ -r:clrzmq.dll hwserver.cs.v1(20,53): error CS0234: The type or namespace name `REP' does not exist in the namespace `ZMQ'. Are you missing an assembly reference? hwserver.cs.v1(20,42): error CS1502: The best overloaded method match for `ZMQ.Context.Socket(ZMQ.SocketType)' has some invalid arguments /home/oompah/work/dev/c++/3rdparty/zeromq/clrzmq2/clrzmq/bin/Release/clrzmq.dll (Location of the symbol related to previous error) hwserver.cs.v1(20,42): error CS1503: Argument `#1' cannot convert `object' expression to type `ZMQ.SocketType' hwserver.cs.v1(26,28): error CS1502: The best overloaded method match for `ZMQ.Socket.Recv(params ZMQ.SendRecvOpt[])' has some invalid arguments /home/oompah/work/dev/c++/3rdparty/zeromq/clrzmq2/clrzmq/bin/Release/clrzmq.dll (Location of the symbol related to previous error) hwserver.cs.v1(26,28): error CS1615: Argument `#1' does not require `out' modifier. Consider removing `out' modifier Compilation failed: 5 error(s), 0 warnings </code></pre> <p>I am not sure why there are so many errors when compiling what is ostensibly, a "trivial" hello world example code supplied with the guideline.</p> <p>The .Net assembly for zeromq built succesfully, so I don't see why I am getting the errors above (assuming that there is nothing wrong with the code above) - how do I fix this?</p> <p>I am running on Ubuntu 10.0.4 LTS, 64 bit.</p> <p><strong>[Edit]</strong></p> <p>Details of my mono build are as follows:</p> <pre><code>Mono JIT compiler version 2.10.2 (tarball Wed Jul 20 17:42:26 BST 2011) Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: softdebug LLVM: supported, not enabled. GC: Included Boehm (with typed GC and Parallel Mark) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload