I am planning to use SCTP for a embedded Linux project. Anybody has some comments on SCTP usage, mostly in one-to-many mode? Did it beat using a home-made UDP-based equivalent solution?
I control the network environement and all devices involved, so compatibility is not an issue.
I have made extensive use of lksctp and have found it to be robust and interoperable with many other implementations of sctp. The standard for the sockets API for SCTP is still evolving but is quite mature and I would expect any further changes to be backwards compatible.
I would use it with confidence.
The ACE library has a performance test for SCTP, so I would assume that it works.
Currently these programs provide the only example code on
how to use ACE's wrapper-facades for SCTP. In the future additional
code will be placed in the ACE_wrappers/examples/IPC_SAP/SOCK_SAP
directory.
Using a framework like ACE is a good idea anyway, as it alloes you to program on a higher level and shields you from the error prone low level details of socket programming. As an additional bonus your code will be portable to all platforms that ACE supports.
Best answer is the comment:
Also, SCTP support in Glibc is less than ideal (in other words, non-present) -- you must use the libraries from lksctp, and it's not entirely well-integrated into the normal sockets API. Just one more reason to use a nice library that encapsulates the low-level functionality :) – ephemient
Related
I am planning to implement Hiawatha web server on a non-linux platform which is uC/OS-II RTOS.
I need help to port the Linux dependent API's to RTOS platform.
Kindly let me if there are already build libraries that I can use to port Linux on RTOS.
Thanks in Advance
Any code that uses more than just the standard C library will require some porting effort - the extent to which non-standard and OS specific libraries and calls are made will determine the effort required or even the feasibility of such a port.
Most Linux code of any complexity will require a POSIX API and networking code will probably use BSD sockets. Multi-threaded code would likley use pthreads. uC/OS-II has neither of these; it deals with only scheduling, timing, synchronisation and inter-process communication; it is a scheduling kernel, not a full OS in the same sense as Linux - it does not even have a file system - a requirement of most Linux code. Of course adding additional libraries and extensions may provide some or all of what you may need.
Moreover uC/OS-II's simple one-thread-per-priority-level scheduler would make typical Linux multi-threaded code hard to schedule in the manner intended. Most RTOSes (including uC/OS-III) support round-robin/time-sliced scheduling of tasks at the same priority level, but uC/OS-II does not; possibly making it unsuitable for this task.
Something more sophisticated that uC/OS-II may be in order, or perhaps using code more suited to uC/OS-II perhaps. eCos for example is a far more complete RTOS for embedded systems; it is open-source and includes a POSIX API, file-system support and a socket API. It would be far easier to port Linux code to that. Equally there are many lightweight embedded webserver examples that are probably more suited to uC/OS-II and other simple RTOS or even no OS at all. LwIP for example is a TCP/IP stack for small embedded systems for which uC/OS-II ports exist and for which there are web server examples.
The point is that Linux are uC/OS-II are not comparable; one requires < 10Kb of code, the other has a minimal foot-print of about 4Mb! To get Linux code to run on such a system will require you to add a lot of additional code to provide the missing services, and it may not be feasible on your target platform.
[Edit: 08 July 2012]
Have you considered using Micrium's own TCP/IP stack and μC/HTTPs web-server add-on? It is likley to be better integrated to uC/OS-II and provide better performance than non-RTOS specific third-party code.
I have an application which I need to port on Linux. I was thinking to use Free Pascal the problem is the application uses Windows API's to perform tasks such as serial port communication etc... Is there a msdn for linux users or a book covering how linux works internaly if there are apis.
I am very confused.
Well, it's sad to say but if your code in very Windows-dependend (not VCL depended!) then probably it'll be faster to write the application from the begining rather then porting it.
But if it's only serial port matter then give a try to multiplatform SynaSer library, find it here: http://synapse.ararat.cz.
hope this help :)
Robert Love has a book on Linux Systems Programming - that will cover this area and Love's books are generally good, so it is worth looking at.
It's not entirely clear from your question, but if your concern is that there are specific calls to hardware controlling functions in your Windows application that make it difficult to port I would suggest that is a misplaced fear. Both Windows and Linux operate on the principle that the application level programmer should be kept away from the hardware and that all that should be handled by the operating system kernel and only be accessible to applications via system calls. As the kernels of different operating systems face similar demands from users/applications, they tend to have system calls that do the same sorts of things. It is necessary to match the system calls to one another but I can see no reason why that should be impossible.
What may be more troublesome is that your Windows application may rely heavily on the Windows executive's windowing code/API. Again finding analogues for your code is not impossible but is likely to be a bit more complex e.g. in Linux this stuff is generally not handled in the kernel at all (unlike Windows).
But then again, your code may be written against a portable toolkit/library like Qt which would make things a lot easier.
Good luck in any case.
If the program contains GUI code you must use linux libraries like GTK/XLIB in order to create windows, forms, buttons, etc...
Windows specific functions (like EnterCriticalSection, WaitForSingleObject or _beginthreadex) must be replaced with equivalent linux api functions (a nice tutorial can be found here:
"www.ibm.com/developerworks/systems/library/es-MigratingWin32toLinux.html") or you can use libraries such as w2lpl or wine
A useful library for this kind of problems i've found at http://www.adontec.com/windows-to-linux-port-library.htm
I've had great experiences just using WINE. (https://www.winehq.org/)
You don't really port your app at all. You just make sure it doesnt violate some of the basc constraints of WINE and just run it as is. WINE (though is says it is not) is an emulator of the windows API's and will just do the translation for you. It's pretty complete in its coverage of the API's.
I am looking to implement a SIP VoIP client using any of the scripting languages - either perl, python or ruby or others. I have knowledge of SIP but have not tried anything with scripting languages. I did have a look at perl module Net::SIP for the same and found it to be interesting.
I am looking for something that provides SIP functionality, not media support. Are there any such SIP implementations (like Net::SIP) in the scripting world that are used for this purpose? This is required to do basic functionality testing and not for stress testing.
use sipp, it relies on xml scripts to send and receive sip messages, it is documented and widely used in telecommuncation industry.
The sipsak tool is commonly used for SIP testing purposes. It's command line based so you could script its operation. If you need to finely control your SIP messages then it's probably not going to be suitable as it's unlikely to expose a sufficient level of control for you.
If you have two months to wait. then there will be ivrworx RC version http://www.slideshare.net/borisusun/ivr-worx :) Also you can help with development.
Is there an equivalent to Linux DBus on OSX? I mean, is there a "message bus" available by default on OSX?
Disclaimer: OSX newbie here.
If you need to use DBus you can install it via Homebrew.
Homebrew is a package manager for OS X providing a lot of libraries which where mostly written with Linux as their primary target.
The DBus package can be found here
However, this is not installed by default and if you intend to write Cocoa applications the way to go would be to use the (distributed) notification center as mipadi explained in his post (which you also accepted).
If you need a robust middleware for communication you can also have a look at IceTouch from ZeroC which is a Cocoa library for using the services and functionality offered by their Ice framework.
The package contains IceStorm for example which is a publish/subscribe server or the IceGrid service which can be used to build large scale distributed systems
Probably the closest analog would be distributed notifications (or notifications for same-process communication). It's not a perfect analog, but it fits into roughly the same niche. You can read more about it in Apple's Notification Programming Topics, particularly the part about the distributed notification center.
There's Mach's ports, which will probably do what you need: http://en.wikipedia.org/wiki/Mach_(kernel) .
You could check DarwinPorts. It should include the dBus libraries.
Is it possible to write a mobile application with J2ME and whenever we want to implement a functionality not offered by J2ME call native mobile API ? (kind of like what is done with .NET, whenever you need something not provided, you just call the Win32 API from the .NET platform).
While JNI is not officially supported in J2ME, the Symbian implementation of J2ME obviously uses something very similar.
Since most J2ME APIs have a corresponding Symbian OS C++ API, what Symbian did (a lot) is develop adaptation layers between the 2.
Between that and the new modular architecture of the IBM J9 virtual machine (from Series60 3rd edition feature pack 2 onward), it is technically possible to add a new API to the virtual machine without actually needing to recompile most of a handset firmware.
However, third party developers simply are not allowed to do it without a lot of help from the handset manufacturer.
A loopback socket connection is the solution that people have tipically implemented to transfer data accross the language barrier. Large-scale deployment is not the easiest task, though, as you technically need to install 2 applications on the device. Once you understand the threading model of the Symbian J2ME implementation, you also realize how ugly and inefficient a hack it is.
When you reach that kind of issue, it's time to learn Symbian OS C++ and do it right.
No. That's not possible with Java ME.
Only sort of. Actually it is possible but not directly. You can write a native server that listens on a local socket and send requests to it from your Java MIDlet. Someone even released a framework to do this called MIDP-JNI (as opposed to real JNI). Obviously the form of the solution imposes some limitations on what you can do with it but it isn't actually impossible.
Be aware that using this approach can make your application much more complex to debug.
If you are specifically looking out for Nokia/Symbian, then APIBridge http://wiki.forum.nokia.com/index.php/J2ME_API_Bridge_Interface could be a solution. Typically it is the 'official' version of 'native server on local socket' kind of thing. The APIBridge is 'extensible' & you can write your own 'plugins' for your suitable 'low-level' task.