How do I send and receive network MIDI data in iOS? I am able to resolve the server using bonjour and apply the service to a MIDI connection, but I don't know where to go from there. The documentation seems to be lacking, and there's not much information online.
Essentially, you need to connect to the session via Bonjour as you have done, and within your iOS app:
Create a client using MIDIClientCreate
Create an input port using MIDIInputPortCreate
This takes a pointer to a C function that will be called when MIDI data is received
You need to connect it to the MIDINetworkSession's defaultSession using MIDIPortConnectSource - connect it to the sourceEndpoint
Create an output port using MIDIOutputPortCreate
You can send data to the network session using MIDISend - send the packets to to the MIDINetworkSession defaultSession's destinationEndpoint
I wrote a few blog posts about this a while back, see here for source code etc.
Part 1
Part 2
Part 3
Related
I have a custom VPN (with a custom protocol for receiving and sending packets) hosted on my local machine and running a Network Extension (NE for short) on my phone. All the configuration for the NE is set and the NE is running and logging to the console. The setup is as follows:
NE is reading packets from the packetFlow using packetFlow.readPacketsWithCompletionHandler
Packets are then sent to the VPN. I used two different methods for testing: the AsyncCocoaSocket library or the native NWTCPConnection to connect to the VPN.
I listen to responses from one options mentioned in 2 to receive the response packets.
Finally, I write the packets received back to the IP stack using packetFlow.write
I send the packets as I receive them in the AsyncCocoaSocket delegate methods or the NWTCPConnection read completion handler. The VPN responses sent match the ones received in the NE before writing them back into the stack.
The issue I'm having is that for example when I make a browser request the site doesn't render. It only works with very basic text-based test sites and single images. It only on the first request however not always guaranteed. It is very random and no packets seem to be dropped in the flow.
Summary:
Browser => Network extension read from packet flow => forward requests to VPN through tunnel => Listen for responses in Network Extension => write responses using packetFlow write => Browser
I'd expect the browser to render the site but it doesn't and neither do the apps making requests work.
Any guidance would be appreciated.
NOTE: This all works flawlessly when I connect using an Android device.
I am working with socket io using AppCoda this Tutorial. connect to socket server using node.js and swift, working fine , But it was group chat if we send the message it is showing to all users available in the socket . But How can we send messages one to one I am using socketio/socket.io-client-swift till now I can able to connect the socket after that what I will follow to create one to one chat.
As per my search we need to create a chatroom for two persons,But I am not sure Please let me know.
I'm coding a simple chat application and I'd like to add a shared drawing canvas to my application which is using data channel to send canvas points between them. But it's a optional specification so I don't want open a data channel each time of opening a chat. If I open data channel after establish the peer connection (after offer), I can not send any data over data channel. Otherwise I can send (I got this point from here: https://stackoverflow.com/a/35141500/5663292). So why I have to open data channel before peer connection offer?
The SDP offer/answer is what establishes how exactly your peers want to communicate. The offer includes the actual connection method (IP/port/TURN relay) and what streams, codecs and channels you want to use. The answer narrows this down/confirms what the other peer can accept.
If you want to add anything to the communication, like an additional media stream or a data channel, you need to inform the other peer of that, otherwise it doesn't expect anything/can't handle it.
The flow is always:
prepare anything you want to send to a remote peer on your local RTCPeerConnection
generate a local description
send it to the remote peer
await the remote peer's answer
incorporate the remote's answer (setRemoteDescription)
Only then are both peers on the same page and can really talk to one another. Repeat this procedure whenever necessary, i.e. whenever you substantially change anything about what you're sending.
I am trying to write an iOS application that connects to an OBD-II Interface over WiFi (specifically the OBDLink MX WiFi Scan Tool). I have written some basic socket code taken and I am able to open a socket to 192.168.0.10:35000. I receive the NSStreamEventOpenCompleted for both input and output streams.
The first event that fires shortly after is the NSStreamEventHasBytesAvailable. I attempt to read the stream, but the length comes back 0. My question is what is the flow of execution for communicating with these devices? I have tried to issue an ATZ\r command, but nothing is happening (no stream events are firing).
How do I know if if I am connected and the OBD-II interface is ready?
The usual command terminator is ˋ\r\nˋ, so first try sending ˋATZˋ with this command. Only send, after you have received the HasSpace notification from the ˋNSOutputStreamˋ.
Another alternative to communicate with this device would be this Car Diagnostics API, access to the API can be found on
https://github.com/HellaVentures/Car-Diagnostic-API
I am stuck creating a socket connection between blackberry client and java server. I need simple sample code which extends the socket API example from blackberry sample code.
We have a server that communicates with android systems and we need it to work with blackberry client as well.
Sorry for being late. And I am posting my comment here because of comment length. _screen.isDirectTCP() isn't an API method, so I am not sure what does this method return. But from the method name/signature I think this method is only used for checking whether Direct TCP connectivity is available or not on the device. Depending on the result, the application will append the connection parameter such as ";deviceside=....".
From the Network Transport article,
If you do not want your application to rely on the default connection
types described in the previous sections, explicitly state the
desired connection type by adding the “deviceside=” parameter to the
destination URL. If an application appends “;deviceside=true” to the
destination URL, then only a direct HTTP or TCP connection is
attempted. The application does not attempt to connect to the network
using the BlackBerry MDS. Alternatively, if an application appends
“;deviceside=false” to the destination URL, then the application only
attempts to connect to the network using the BlackBerry MDS. The
application does not attempt to connect to the network using a public
IP gateway.
Also please have a look at this link, What Is - Different ways to make an HTTP or socket connection.