I am curious about the tcp proxy implementation.
Can you give me some tips about how to understand and develop a naive version?
And is there any good materials(or open projects) or tutorial on it? =)
Building a well working proxy is no simple task as you will have to understand and handle several protocols etc. in both directions...
I would recommend to either use an existing library for that OR some configurable proxy...
http://www.mentalis.org/soft/projects/proxy/ (with source)
http://fusion.corsis.eu/ (with source)
http://www.wingate.com/
http://www.squid-cache.org/
Related
Besides, this framework support multithread construct, provide POSIX_like interface(including epoll), also support multicast.
Thank you all!
you may try using vpp by FDio.
you can give a try to UDPDK which is the most usable and closest to UDP like implementation (with DPDK under the hood) that I have found so far though you have to add/tweak some things before integrating in prod code
Is it possible to have RabbitMQ Consumer listening to a queue for message via AMQP protocol. I am aware that nginx only supports HTTP/s protocol. Was wondering if this can be achieved by using tcp module extension.
I am using nginx as API Gateway and want to do a protocol translation from AMQP to HTTP since all the backend service's are exposed on HTTP.
It would definitely be possible writing your own C extension. nginx is suitable for TCP proxying, therefore I don't see any reason why you couldn't send your own TCP packets to RabbitMQ using nginx, and consequently use nginx as a RabbitMQ consumer. It's probably a lot of work to make it run, and even more work to make it stable and reliable, but doable. Do me a favor though, don't do this. There will always be better, more elegant and simpler solution.
HTTP is definitely not suitable for consuming from a queue (in the amqp sense) because you have to keep the socket open while you consume. However, you could write a C extension to publish/retrieve messages to/from RabbitMQ (and apparently, somebody has already done this). If you're not that much into C or don't want to maintain your own nginx package, you could also write a LUA extension for lua-nginx-module (once again, somebody seems to have worked in this direction). These are PoC for talking to MQ from nginx, but they are not consumers. Both extensions seems to act in the HTTP context, so you need to answer (and close the socket) pretty fast.
However, as far as I know, there isn't any community-driven and well maintained project that would serve this purpose directly or indirectly; you'd have to make and maintain your own extension/client. Moreover, nginx is your current API gateway. Do take the risk into account. Things could go really wrong. Only you can tell whether it is worth the hassle or not, but it's most likely not.
Since you don't gave that much information on what you're exactly looking for, I just answered you on the NGINX/AMQP part. But you might just be looking for an HTTP interface for RabbitMQ. In this case, the Management Plugin might be the way to go. It has a pretty cool HTTP API. Once again, you'd loose every stateful features (like basic consuming, ack/nack/rejects), but that's inherently due to the way HTTP is designed.
Eventually, if you really need a RabbitMQ "basic-"consumer, I would recommend you to write a proper consumer as a separate application and forget about doing this in nginx. That's definitely the best and most supported solution.
Netty is really well documented when it comes to TCP, but I wanted to try a simple UDP server-client example and didn't find any good code out there. (mostly mailing lists and users with allegedly buggy code)
Anyone care to provide some simple example? Thanks!
Maybe this will help you
https://github.com/normanmaurer/javamagazin-netty-ws/tree/master/src/main/java/me/normanmaurer/javamagazin/netty/examples/ws
It also bootstrap a simple udp server
I'm trying to write a windows kernel driver which requires tcp/ip communication using NDIS 5/6. Since it will use NDIS, as I understand it, it needs it's own tcp/ip stack implementation.
Could anyone point me in the direction of an implementation of this, or something close to it?
Any help would be greatly appreciated!
Kind regards
You don't need to implement your own TCP/IP stack!
First, are you sure that this needs to be done in a driver? All your complex code and business logic should usually be in a usermode application or service. Drivers are mostly meant to be very simple wrappers around hardware. This rule isn't just some abstract principle either — it's much easier to write usermode code, where you can use a familiar debugger and the much-broader set of Win32 APIs. You'll solve your problem sooner if you can move most of your code to usermode.
If you really must do TCP socket I/O in kernel mode, then you should use Winsock Kernel (WSK). WSK allows you to open a socket, similar to Winsock in usermode. (Although the usermode Winsock API has more options and features; WSK is bare-bones).
WSK is available on Windows Vista and later. If you must support Windows XP, then you need to use TDI. TDI is much harder to get right; I don't reccomend using it if you can avoid it.
i am writing a flash app that receives its data over a XMLSocket. On the testmachine that worked really fine, but now the data will be ssl secured. Is there any XMLSSLSocket or something similar available? If not XMLSocket a normal SSLSocket would be a great help as well.
you have to use binary sockets and as3crypto: http://code.google.com/p/as3crypto/
The opensource Forge project that does SSL/TLS in JavaScript and raw sockets via Flash might help:
http://github.com/digitalbazaar/forge/blob/master/README