Hello, On 04/18/2014 10:03 AM, Mhamad Hmad wrote: > Hi, > I built small test server application using lwip stack to work like > echo server . > i tried to associate the socket with a stream by using fdopen but it > failed . > when i using the mode "r" or "r+" it give invalid parameter error, > in the same time when i try to write on the file descriptor returned by > lwip_accept it is write to the client .
I am not proficient with using 'fdopen' on Genode but I see a glaring problem in your code: You are mixing the lwip_* functions with libc functions to which you pass lwIP socket descriptors as arguments. The problem is that the C runtime (which provides 'fdopen') is not aware of any file descriptors of the lwIP library. The lwIP socket descriptors and libc's file descriptors are different name spaces. Fortunately there is a solution to bridge the gap between lwIP and the C runtime. Using the 'libc_lwip_nic_dhcp' libc plugin, you can use the normal BSD socket interface instead of the lwIP interface. So instead of 'lwip_accept', just use 'accept'. The pluging wraps the 'lwip_*' functions and creates a proper libc file descriptor for each lwIP socket descriptor. The descriptors returned from those functions are consistent with the name space of the C runtime. I.e., they can be specified as arguments to 'select', and hopefully also to 'fdopen'. Best regards Norman -- Dr.-Ing. Norman Feske Genode Labs http://www.genode-labs.com · http://genode.org Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ Genode-main mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/genode-main
