How does SWIFT work? - edi

I would like to understand the way SWIFT messages work. I tried to understand from Google and it says that it uses packet switched network mechanism.
It would be of great favour if somebody can throw light on the following questions
Whether SWIFT by itself a communication protocol like AS2
For Trade finance system if I use IMEX does using a SWIFT message requires any Adapter kind of components with IMEX
Architecture of SWIFT

How SWIFT works is a big subject, but it's basically a proprietary protocol driven by the needs of the SWIFT community.
Since it all started in the early days of computing, the core stuff uses the UNIX philosophy of: write programs to do one thing, do it well, and use text as your inter program communication.
So, to take FIN messaging, SWIFT works using ASCII text files across a secure network.
To be able to send and receive these text files you need to join SWIFT. See http://www.swift.com/ordering/join_swift
The architecture is proprietary, but, once you join SWIFT you can send and receive specifically formatted text files, or, in the "next generation" it's XML but, to me, that is trying to re-invent the UNIX philosophy, which is bound to fail, and be very expensive in the process. But apparently this is what clients wanted...........?
So there you have it...

Related

Rest Server on iOS device using Swift

I need a way to have an iOS application that can accept a message on a device connected via USB, query a bunch of data about the device and return a response with this data.
I am brand new to iOS and swift development so I need something that is;
Simple
Uses CocoaPods (due to lack of ios support in Swift Package Manager)
NOT require distribution via the App Store (which I believe rules out using APN)
I have tried the following:
BlueSocket: https://github.com/IBM-Swift/BlueSocket
This can probably do the job but is very low level and require lots of work around handling buffer sizes, etc. So a REST solution might be a better
Kitura: https://www.kitura.io/
This seems ideal. However, it only appears to support Swift Package Manager which makes it a big PITA to implement currently (reminder; swift/ios newb here)
CoacoaHttpServer: https://github.com/robbiehanson/CocoaHTTPServer
This looks ok, however I can only find Objective-C examples. Would prefer to have something that includes solid Swift examples (also, the repo doesn't look like it's been updated since 2015)
Are there any other approaches I should consider that I haven't listed here?
You may want to check https://github.com/IBM-Swift/Kitura-HelloWorld-iOS.
I wrote a couple of blog posts about it https://developer.ibm.com/swift/2017/03/13/kitura-ios/, https://developer.ibm.com/swift/2017/12/08/kitura-ios-part2/.
Note that it is a demo repository, I do not know if IBM will support Kitura on iOS (it is supported on Linux).

Arduino-LoRa module code doesn't work

I am trying to develop an Arduino sketch in order to send Temp-humi data from a dht11 sensor to KPN (Dutch) Network throughout a LoRa module (Dragino).
There are plenty of sketches around internet with similar function, but none of them has the right function I expect, since most of them ONLY send a simple 'Hello world' data throughout the ABP or OTAA Keys that the Network provides. In the other hand, I have also found sketches that ONLY makes the temp/humi functionality, withouth having the chance to write the Activation Keys.
So, I am actually trying to join these two codes with these functionalities (Request the Activation Keys to connect with KPN Network, as well as the sender sensor data), and it seems to compile properly, however, it is not sending any data, so probably the code is wrong.
May I get any link to the right one or any recommendation, please?
Many thanks in advance.
Project Code:
enter link description here
I have also had my problems with the Dragino shield and dht11 but i got it working.
My script: https://github.com/FelixKunz/LoraDraginoDHT
I would recommend you to use the RN2483. I've had rarely any troubles with this chip and it is not as expensive as the dragino shields.
en prettige dag

Information about API's, Core data iOS design from the start

Good Morning,
I am in the process of designing an app. It will capture data in the device and will sync with a web server, I have a few months learning Swift to develope iOS apps and I am learning to use core data now with small samples.
I have a book I've been reading and available resources like this one:
https://developer.apple.com/library/watchos/documentation/Cocoa/Conceptual/CoreData/index.html
My question is:
Do I have to start learning how to sync and save data in the device at the same time? or I can learn Core Data first, make the app and then start the process of syncing (using JSON)?
What available resources can I see to learn what I need?
This is new for me, I have a friend who knows Ruby and has knowledge about API, but he does not know how mobile devices works in this matter.
I have searched here, but a lot of question and answers I see covers specific topics.
Your help and time is really appreciated. Thanks!
P.S.
I apologize for the term sync (send and receive data to/from the server) if I a using it wrong, or should I use the term API? For me is a little confusing on how to use the term, since it is use for a few things, like data, but also it's used when talking about a method which all the info you need to go to the API of the method, function or class.
The process you should follow is first learn basic iOS developemeet. Check out the tutorials at raywenderlich and hacking with swift. In the process you will learn a bit about networking(working with APIs) and Data Persistence(Core Data).
Since collection of data precedes storage of data you must learn first about REST APIs, JSON, JSON parsing and related stuff, third party libraries available like Alamofire and SwiftyJSON(these can be installed using cocoapods)
And then jump into data persistence which can be done through sqlite database(FMDB is a wrapper available and is super easy), Core Data, NSUserDefaults, plist, Realm etc.

Getting started - creating an iPhone app that controls another (non-iOS) device via bluetooth commands

All,
Apologies in advance - this question might be too open-ended for SO.
Anyway... A friend of mine (an engineer and entrepreneur) is in the process of building a high-tech piece of lab equipment. He's asked me about the feasibility of building an iPhone/iPad/iPod application that would allow users to control the device via Bluetooth, so I'm helping him gather some information. I'm hoping to get a few pointers on how to get started. Specifically:
Would this require a native app, or could this be accomplished with HTML5 (with or without something like PhoneGap?)
Can you point me to a good primer on bluetooth networking? Everything I've found assumed a VERY high level of pre-existing knowledge.
What are the basics on how something like this is accomplished? Is there a single, established protocol for how one device "controls" another, or is bluetooth more like SSL - just a pipe that allows you to convey any type of message?
I realize this question is incredibly broad and detailed - so I'm not really looking for specifics. But obvious Google searches don't turn up much, and I'm otherwise having a hard time finding a good starting point.
Thanks in advance.
You can communicate via bluetooth in two ways: One is using the Low Energy Bluetooth capabilities of iOS 5 and newer iPhone/ipads.
https://developer.apple.com/library/ios/#documentation/CoreBluetooth/Reference/CoreBluetooth_Framework/_index.html#//apple_ref/doc/uid/TP40011295
Unfortunately the documentation is sparse and will require some hacking away. If you choose this route I would consider starting here and learning as much as you can about how the protocols work before hacking into the framework:
http://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx
The limitations of this route are that it might not be best for sending a lot of data. I have only built stuff that sent simple commands which it does work great for.
The other option is the external accessory framework. This will require you to get an mfi license from apple (not fun). You will also need to pay royalties. But it will do what you want. You won't need to concern yourself much with underlying protocols if you use this, the framework provides a friendly api for processing streams.
http://developer.apple.com/library/ios/#documentation/ExternalAccessory/Reference/ExternalAccessoryFrameworkReference/_index.html

Available Game network protocol definition languages and code generation

I've been looking for a good general purpose binary network protocol definition framework to provide a way to write real-time game servers and clients (think World Of Warcraft or Quake III) in multiple languages (e.g. Java backend server and iPhone front-end client written in Objective-C and Cocoa).
I want to support Java Flash clients, iPhone clients and C# clients on windows (and XNA clients on XBOX).
I'm looking for a way to efficiently send/receive messages over a TCP/IP or UDP socket stream connection. I'm not looking for something that can be sent over an HTTP Web Service, like JSON or XML marshalled Objects. Although Hessian's binary web service protocol is a very interesting solution
I want a network protocol format and client/server basic implementation that will allow a client to connect to a server and send any message in the defined protocol and receive any message in the protocol without having to bind to some kind of RPC endpoint. I want a generic stream of any message in my protocol incoming and outgoing. This is so that I can support things like the server sending all clients the positions of various entities in the game every 100 milliseconds.
The network protocol frameworks I've found are as follows:
Google's Protocol Buffer - but it lacks support for things like sending/receiving arbitrary messages from your given protocol.
Apache Thrift - an interesting option but it is geared mainly towards RPC instead of generic game client/server socket type connections where the client or server can send messages at any time and not just in response to a client RPC request.
Raknet Multiplayer - Raknet provides full multiplayer network library (it's free for indie development with revenue under $250k)
UPDATE : OculusVR Acquired RakNet and its Free/OpenSource now. U can find it on Github
Hessian Binary Web Service Protocol - is a HTTP web service binary protocol, it is well-suited to sending binary data without any need to extend the protocol with attachments.
Raknet provides a good game/simulation oriented multiplayer library.
Apache Thrift and Google's protocol buffers seem to be the simplest approaches to using in a game network protocol client/server architecture.
Hessian seems like a great fit if you want to create a web based game server with a Java or flash client using some type of server push technology like COMET. Hessian might provide a really interesting way to support real-time games on the web and even be able to host them on VM web solutions like Google's App engine or Amazon's EC2.
There's some discussion about using various protocol definition frameworks for games and other uses:
Comparison of Various Serialization Frameworks
Thrift vs Protocol Buffers - Thrift is declared the better framework because it has a fully supported RPC client/server implementation
Using Protocol Buffers for client server Game API determining what type of message to decode
Bi-Directional RPC using thrift
DIS
If you do go the route of writing your own protocol, you may want to read the answer I posted here.
In summary it discusses what you should think about when writing a protocol, and list a few tricks for versioning and maintaining backwards and forward compatibility.
If you are really concerned about multiple platforms and language, be sure to take into account endian issues. A binary protocol designed for this use must use network-byte-order, so it needs custom per-data-type serialization functions; you cannot just blindly push C structs into network buffers.
A common solution for this problem at game companies is to have protocol description language or specification in a simple format like XML or python or lua, and then have code generation for each target language that generated packet classes with both data structure and serialization. This specification could use a type system that starts with basic types, then extends to include game-specific types with semantic information, enumerations or more complex structures. For example a data file could look like:
Attack = {
source = 'objectId',
target = 'objectId',
weapon = 'weapon::WEAP_MAIN',
seed = 'int'
}
This could generate code like:
#define PT_ATTACK 10002
class PacketAttack : public Packet {
public:
PacketAttack () : m_packetType(PacketAttack::s_packetType) {}
ObjectId m_source;
ObjectId m_target;
WeaponType m_weapon;
int m_seed;
bool Write(Stream* outStream) {
Packet::Write(outStream);
outStream << m_source;
outStream << m_target;
outStream << m_weapon
outStream << m_seed;
}
bool Read(Stream* inStream);
static const int s_packetType;
};
This does require some more infrastructure.. streams, packet base classes, safe serialization functions..
I want to echo Bill K's suggestion. It's not hard to roll your own protocol.
For the iPhone side, have a look at AsyncSocket which support for delimiter based TCP packets built in, and it's not hard to build a solution which uses packet headers.
If you quickly want to have a testserver to play against AsyncSocket on the iPhone, you can look at Naga (for the java server part) which has ready made stuff both for delimiter based packets and packets with headers. Naga was partially written with networked games in mind.
I disagree with "roll your with simple delimited strings approach": question is, what exactly would be the benefit? Getting to write and maintain more code?
The only reasons I could see would be lack of tool support (writing for some odd platform), or specific (very) hard performance or message size constraints.
Or, sometimes, really wanting to write a format -- that's ok, but it must be an explicit reason.
Depending on exact needs I would suggest considering JSON, since it can read and write arbitrary messages; has good object binders for Java (just like xml), is easier to read than binary formats, and is all around "good enough" for many use cases.
If message size is very important, Protobuf can work well -- while its size is not always as small as gzipped alternatives (gzip+xml, gzip+json compress very well), it's usually close.
ASN.1 fits the definition of "good general purpose binary network protocol definition framework". It's also standardized by ITU-T, so there's a lot of existing tools and libraries for various languages.
The DER encoding is suitable for efficient network communications, the XER encoding for human-readable (and writable) permanent storage.
Because you want to use different languages and also because you want something clean/small, I suggest the protocol buffers of google. You need a pre-compile part for the RPC but I really think that's the best option when you begin to mix different languages.. Here's the link: http://code.google.com/apis/protocolbuffers/docs/overview.html
Why not implement UDP directly? Your question mostly mentions what you don't want.. What further form of abstration do you want on top of UDP?
Download the Quake III sourcecode and see how they frame game updates over UDP?
The IP protocol has been designed to support multiple devices/OSes in a uniform way, isn't this what you ask for?
What protocol has implementations across a huge range of systems, hmm, IP perhaps?

Resources