LAN service discovery - service

I need to do a simple service discovery in Codename1, to allow clients
running on the same LAN to discover one another. The natural
approach would be broadcast UDP packets, but they seem to be
unsupported. Another approach, a lot less desirable, would
be to go outside the lan and implement a web service.
Suggestions would be welcomed. For the moment, I'm only
interested in Android.

We don't support that. You can use a native interface which would be pretty easy to implement in Android as you would implement it in Java.
We already have two cn1libs that implement TCP and websockets so you can get a general idea of how to do something like that from there. Although I'm guessing what you would need could be far simpler.

Related

Doubts about network protocols and UseNet

Sorry for my ignorance , but this subject has been stressing me for days
I currently read in a book about networks that there is a UseNet that is like a blog , but uses a different protocol to communicate
My question is, when I'm developing a software, can I decide which application protocol will it work?
the TOR browser, I read that .onion sites use a different protocol than HTTP, how is this possible?
We first need to break up your question. There are protocols implemented in operating systems (low-level protos) and those implemented in applications (high-level protos).
What makes early high-level protos so interesting, like Usenet and SNMP, is that they are not dependent on low-level protocols. Basically they just need the operating system to provide a mechanism for streaming data to come to/from the machine they want to speak to. You can see that Usenet's protocol's , UUCP, code can handle TCP or serial connections.
My question is, when I'm developing a software, can I decide which application protocol will it work?
Yes, you ask the OS for your low-level protocol and you then implement your high level protocol in you application. You can also layer protocols ontop of one another.
the TOR browser, I read that .onion sites use a different protocol than HTTP, how is this possible?
While not a TOR expert, general proxy protocols like SOCKS, use TCP at a low level to connect to their first proxy and then using higher level protocols encrypt HTTP requests so they bounce around several proxies.
this is a very high level answer, you can absolutely implement a low-level protocol in an application. I am just speaking to the most common examples

Is it required to use an OPC Server to Communicate with Controllogix?

I'm wondering if for simply communicating with a PLC, like reading and writing tags, do I need all of the other heavy lifting that comes with an OPC-UA server?
I've tried writing a simple server in Python that talks to the PLC, but I get denied when requesting information from the PLC.
The Controllogix PLC I'm attempting to communicate with uses Ethernet/IP to communicate, so why doesn't a simple server/client script work? What is required exactly to communicate with an Allen Bradley PLC or PLC's in general?
There is quite a bit required to communicate with a PLC.
Each vendor has a driver, there are firmware compatibility considerations. Different protocols to think about.
OPC-UA makes it a bit more generic, but OPC-UA still has a set of things to work around when setting up communications.
Most of the OPC products I've worked with, needs to have their security adjusted to allow anonymous communication. It's generally bad practice to do this. (A network intrusion would be able to read/write to your automation layer) There is certificate signing and some encryption business that needs to be turned off if you're looking for simple communication. (Again, not a good practice but ok for learning)
After all that you have to have a notion of how your PLC is set up on your OPC server, there are channels, devices, namespaces etc. You'll point the OPC client to some opc.tcp://:
If you got this far you're almost done, I'm assuming your OPC server is running and has tags configured at this point. You can use your OPC-UA API to do a read. It can return just the value, or you can get an object back with tag health, timestamp, and a bunch of other data. Depends on the implementation. After that you can do subscriptions, writes...whatever else you need.
TLDR: OPC server not required, but may be the easiest method. Turn off security. (But turn it back on before exposing your control layer to the net)
I am also a little late to this conversation. If you are interested in coding your own solutions and don't want to use any of the commercially available standards, AdvancedHMI is a "mostly" open source solution written in VB.NET which is 100% free and provides communications to many different PLCs including the ControlLogix platform. Since I see you are programming in Python you may also be interested to know that the project does work under Mono on the Linux OS. I have used it to write gateways between EthernetIP and ModbusTCP and to pull data serially from OEM devices and push this data to a CLX PLC.
The forum is full of many helpful hints and is very active and supported.
Just trying to give you another option. DDE, NetDDE, FastDDE, OPC, DCOM, Suitelink.... These are all good, but mostly a pay to play adventure. As a programmer, it seems ridiculous to have to pay such an excessive amount of money just to talk to my hardware, IMHO. Sorry for the rant. Have Fun!
Update - Just wanted to also suggest the following open source project written in python:
https://github.com/dmroeder/pylogix
I have used this to write small programs for communicating with CompactLogix and ControlLogix. (Even to/from a RaspberryPi!)
Depends on several factors, if you want something simple to program you can opt for Modbus/TCP I think some AB PLC supports it without extra hardware.
However if you want something with more security for example for industrial use then OPC UA would be better choice but the programming has a complexity far higher than Modbus, even using the libraries of OPC Foundation or others. There is the option of using a commercial or free (if any) OPC UA server to save work, then you will need to program the client side only.
With Ethernet/IP it should also be possible, but the problem is that there is no clear specification and even different AB models talk different Ethernet/IP dialect ! , it is also far more complex to program than Modbus.
I am a little late to this discussion, but there are a couple commercial tools that make this a bit easier. The one that comes to mind for me when you say you are using python is Cogent's data hub. It is certainly not the cheapest tool out there, but they have already done all of the heavy lifting for PLC/PC communications & security.
If trying to read CLX data using Python, there are several open source implementations that will save you a lot of work. Such as this:
https://github.com/dmroeder/pylogix
If you use .NET and Visual Studio, you can use AdvancedHMI
to be able to read and write OPC Tags to ControlLogix platform is done via its communication Driver RSLinx. RSLinx acts as an OPC Server, it will need to be configured to communicate with the PLC and run on a networked PC on the same LAN. Several flavours of RSLinx are available (for WAN/VLAN also) but essentially this is the communications driver you need to talk to AB PLC's

Writing a protocol that has client and server side software

I will be developing a protocol that will encompass a client and a server module.
Several protocols that are close to the one I have in mind exist, but I want to make something simpler with less overhead and with something I have more control on.
The protocol I will be doing can and will be run almost in any scenario, local, web, lan, internet, etc. It can also run on a single box.
My question is, how can I start developing for the server side of the protocol?
Any ideas, insights, key words, starting points would be appreciated.
Regards
Do you want to develop the protocol yourself and then use it? or you are looking for a good protocol to use?
If second, I have recently worked with "Websocket" protocol which enables clients to communicate with each other via a server. It is a really good protocol and there are libraries in .NET ( >= 4.5), JAVA, Javascript, ... It is also supported in many browsers.

How to implement group chatting/message-board mobile app?

I am trying to write a iPhone group chatting/message-board app which will have a backend component. I expect users to register with our system and start posting messages on chatrooms/message-boards. These message-boards can have more than 2 individuals, must support real time notifications and should be accessible from any other clients (like web) as well.
I stumbled upon http://code.google.com/p/xmppframework/ . I realize that XMPP is a very attractive proposition for our needs but I am seriously worried about the infrastructure complexities and scale issues. Besides, XMPP has way too much to offer for my needs. Looks like, XMPP might be the only choice for my pleasure in pain, but I wanted to see what you experts have to say on this.
Any thoughts?
Thanks,
My advice is: whichever protocol you're choosing, do not try to invent your own protocol. Go for XMPP or if you can find an alternative which you find more compelling, use that. Especially if there's already a nice framework for you to use. Why ? Because a single developer new to a field is seldom smarter than a bunch of people with experience ;-) Make use of other peoples' experience by using an established protocol, and make use of existing frameworks to avoid coding mistakes and investing a lot of time to solve a problem yet again that was already solved.
That being said, XMPP is widely deployed and thus would make for a good choice if you later plan to write additional clients for other platforms or want to have third-party clients connect to your server.

Game data across network

I'm designing a game where players are programmed bots competing in a programming contest. The bots can be programmed in any language - Java, Ruby, Python, C#. I'm looking for some way to transmit game data across the network or some way by which the game server can talk to the bots. What would be a better choice for this? Should i use XMPP or some other form of remote method invocation?
What you are descibing is not an RMI problem but a messaging one. I am sure there are several solutions you could use, and based on the limited knowledge of your application, I would say that XMPP is one of them. It is language agnostic and has libraries (and servers) available in most well supported languages.
Whether it is the best solution, I couldn't say, but I would think it is a viable one. It gives you the option for transmitting from point to point, point to many points, and a means for your game server to broadcast to all clients.
A REST based webservice might be easier to use if you need lots of languages to be able to call it.
I always find reinventing the wheel to be tedious. Try and see if you can use OpenTNL.
The issue with many Remoting infrastructures are that they are normally not portable between frameworks.
While XMPP might work for you - the main issue you might find is excessive data crossing the network due to all the header/presence stuff in the data being sent around. Also as XMPP is XML based any binary data would have to be sent around as a Base64 string.
A better bet might be a more low level socket interface - either way having the freedom to do bit-packing to reduce the size of the data will possibly be beneficial.