I am writing a program to transfer files through a lan computers, it's been a while I'm searching for file transferring methods in Delphi. I found UDP is a good solution, but there is a problem: in every example or article I found there was a client program beside a server program, but my program have to send and receive to/from every computer in network, there is no specific server or client, something like p2p, I don't want to make a computer Server and another one Client, what should I do? I searched Indy articles too, it's working in Server/Client mode too (as far as I found).
UDP can work in broadcast mode, which is what you need. But such UDP broadcasts are not routable outside the current network (i.e. they are blocked by routers), so you have to implement something more complex if your project needs to be accessible outside the primary physical network.
Do not reinvent the wheel! If you want to see some working source implementing this concept, see Ares Galaxy:
"Delphi self-organizing p2p network project featuring high scale
capability and fast broadcast-type search system. Client supports
multi-source file transfers, partial file sharing, built-in
audio/video player and decentralized chat rooms".
The source code files are available from SourceForge. You could re-use/adapt the P2P network layer for your needs - but take attention to the license terms of Ares source code, if you use it in your projects.
Have a look at Indy's TIdTrivialFTP and TIdTrivialFTPServer components. TFTP is a UDP-based file transfer protocol.
Related
I want to implement a peer-to-peer video chat feature for a web application I am currently developing. After doing my research, I've decided that using webRTC's Javascript APIs is the way to go. The application uses AngularJS in the front end and Ruby on Rails in the back end. The main issue I'm encountering while conceptualizing this application is linking the front end with the backend, and creating and maintaining the connection between user streams.
For the signaling aspect of the network, I want to utilize ActionController::Live and the Ruby gem em-event source to push live messages from the server to users and indicate which of their connections are online. Then, when they are ready to make a connection, they will create a custom room and the URL will be sent to the user that they wish to connect with, creating their offer. Once the user clicks on the link sent to them, they send back their answer. When the user responds, the ICE candidate process will begin for each of the users. Do you think that this is a sufficient signaling channel to set up the PeerConnection? What other major players am I missing?
From the research that I have done about WebRTC's RTCPeerConnection, once the initial connection is set up, and both users have public IP addresses corresponding to their stream, the connection is sustained through RTCPeerConnection, more specifically getPeerConnection(). Am I wrong? Are there other factors that I am not considering?
WebRTC makes the process of creating MediaStreams very simple with their getUserMedia method. Once these streams are created they can be added to the RTCPeerConnection that was established. Both as local and remote streams.
If you have any other suggestions for me, please let me know. I want to create this feature using webRTC, it seems like so much fun
There are certainly many ways to handle the call signaling so I'm not going to comment specifically on your approach. I will say that if you plan on supporting ICE trickling the ICE candidates will start flowing very early in the process so you really need an open signalling channel between your peers almost immediately when trying to connect to a peer.
We developed our solution for WebSphere on top of MQTT which is an open, and very simple pub/sub protocol. You can use any open MQTT broker with the protocol and there are a number of open source components available to make WebRTC development extremely easy including an AngularJS WebRTC module (angular-rtcomm), a core pure JavaScript module and much more. We also released a simple JSON based protocol as part of this open source solution. You can take a look at the signaling protocol. You can also read more details about the overall solution here (www.wasdev.net/webrtc). Here you'll find the base JavaScript libraries as well as a number of open source sample solutions. All of these can be forked on github.
In general you want to build your signaling on a protocol that will allow you to grow over time. It should work well for the web and mobile apps. From our experience it took a lot of time to get all this to work well and our goal was to not only support peer-to-peer calls but to support using media resources like Dialogic's XMS PowerMedia server on the backend for multiway support, record/playback and more. We also needed to support federation via SIP trunking so we wanted to make sure the protocol could be easily translated to SIP signaling while also supporting transcoding between media protocols like VP8 and H.264.
Note that if you're looking to only support peer-to-peer calling between WebRTC clients you can do that with these rtcomm open source components only, including an open MQTT broker and save yourself a ton of time. You can literally get something up and running in a matter of hours. The developer version of the WebSphere Liberty beta with the new rtcomm-1.0 service enabled also includes a built in MQTT broker and supports the open WebRTC signaling protocol linked above. You can use WebSphere for development and deploy a single server of this in production for free. You can also use Ruby on Rails with Liberty as well if you'd like.
Even if you decide not to use Liberty you can use all the open source components along with something like Mosquito (which is an open source MQTT broker) to get a solution off the ground quickly. There are also a number of MQTT clients available for many different programming languages including JavaScript, Java, etc. Check out https://eclipse.org/paho/. If you decide to build you're own signaling protocol you might still find these open source components helpful to see how we approached integration with the WebRTC PeerConnection.
Quite a lot of webpages address this issue but I cannot find a simple (I am a begginer) explanation about how to setup a connection between iOS device and Mac computer. I read things about sockets and service publishing with Bonjour and the Apple documentation but it is quite heavy to understand since there is no tutorial and examples.
Does anyone know how to get the basics to setup a connection and send one file over the network or have a good tutorial to share?
Bonjour provides a way for applications to advertise their services and other applications to discover the advertised services.
The main components of a service are
the address (e.g. 10.0.1.52 in the local domain 10.0.1.1)
the type (e.g. Apple Filling Protocol "_afpovertcp._tcp")
the name (e.g. JustinsMacbookPro.local)
the port (e.g. 5687)
These components provide all of the necessary information for a "browser" to figure out how to network with the other application (e.g. setting up the network sockets).
However, Bonjour does not provide a way to send data. Applications send data to other applications using sockets. If you don't want to directly use sockets then you can use high-level protocols that are built on top of sockets like FTP, HTTP, etc. I recommend giving Beej's Guide to Network Programming a read if you want to learn the basics of sending and receiving data over a network.
I have already developed a Clinic management application for Allergy Control Clinics which stores patients' medical files and test results in a database and generates reports for analysis.
there's a section for storing spirometry results in the database. currently i get results
from an Excel file which is exported by WinspiroPro (the application that comes with spirolab devices) and store them in the database.
few days ago i came across the word "HL7" which seems to be a Standard protocol for communicating with these medical devices, so i can directly get the results from the device using Delphi.
also in spirolab device user manual it is mentioned that the device is compatible with this system.
now my question is, how can I implement this system (HL7) in delphi?
Thanks
As is usual with these kind of inter-professional standards, you need to pay to get them, at least on http://www.hl7.org in this case.
If I search around on the net, there may be existing tools that you can use, or have a look how they work internally:
http://code.ohloh.net/search?s=HL7
https://code.google.com/hosting/search?q=HL7&sa=Search
http://sourceforge.net/directory/?q=HL7
HL7 is not bound to a specific transport layer. It is a protocol on the application level, the seventh layer of the ISO 7-layer-model, hence Level 7. It describes messages and the events, when this messages should be send.
It just gives some recommendations how to do message transfer on the subjacent layers, e.g. MLLP with tcp socket communication. But in principle you are free to use any transport layers you want, may it be direct socket communication, file transfer or what ever.
Although most systems now can use tcp, it is also possible to use HL7 with different underlying transport protocols as RS232. If I remember right, there was also an example about message transfer / coupling with RS232 in the implementation guides of the documentation. And yes, the documentation and protocol standard documetation is free after registering.
Did you ask your provider for the WinspiroPRO version with HL7 ability? Maybe it supports already socket communication with tcp.
Otherwise you either need access to the sourcecode of ldTCPCClient and replace the tcp part with an RS232 part or you have to use a software just for parsing/building (unmarshalling/marshalling) of HL7 messages together with a software, that handles the transportation level.
By the way, just from the name, I guess that ldTCPclient is not apt for your need, as you will probably need a host and not a client component.
I have a custom pair of client/server sockets (TJDServerSocket and TJDClientSocket) which wrap the TServerSocket and TClientSocket in the ScktComp unit. I don't have any issues to fix, but would like to know something. I'd like to add a feature to the client side to automatically search the network for any instances of a server socket (specifically my server component).
I'm open to any suggestions, but has to be specific to the use of the ScktComp unit in Delphi 7.
Here's a link to the components of mine.
Never used the TServerSocket and TClientSocket myself, and I don't have the help files within reach, so I can't immediately see if this would work with those components.
For a project I did I needed something like that too. I ended up with using UDP to broadcast a discovery request (within the same subnet of course). The server, listening on a particular port for such a request, would reply its data back. When multiple servers would exist (a situation that though rare could occur) the client just picked the server with the required service(s) and the least load. That load was part of the data the server send back.
It worked out nice, wasn't all that difficult to write, and turned out reasonably efficient too.
The request protocol is completely up to you. The one I devised allowed clients to send a request detailing the services they need, and servers replying listing their services and the load (= connected clients in active use).
After selecting the server to talk to, a client would register itself for the services it needed, and could use them after that.
Hope this helps.
There are some standard protocols for service discovery. See for example: http://en.wikipedia.org/wiki/Zero_configuration_networking
Mailslots is a nice option here. It'll broadcast to every PC on your subnet. See Jeroen's answer to this question:
Suggestions on writing a TCP IP messaging system (Client/Server) using Delphi 2010
Searching is as easy as port scanning.
If you don't like the brute force approach, the server can register itself to a well known service application (could be a web server), and the client can connect to the service application to ask. It's quieter than broadcasting.
With more information, such as details about the network (who's it for?), I can suggest a more precise answer.
I would like to write a messaging system using TCP IP in Delphi 2010. I would like to hear what my best options are for using the standard delphi 2010 components/indy components for doing this.
I would like to write a server which does the listening and forwarding of messages to all machines on the network running a client.
1.) a.) clients can send a message to server to be forwarded to all other clients
b.) clients listen for messages from other senders (via server) and displays messages.
2.) a.) Server can send a message to all clients
b.) Server forwards any messages from clients to all other clients
thanks for any suggestions
NOTE: I am not writing a instant messaging or chat program. This is merely a system where users can send alerts/messages to other users - they can not reply to each other! NO commercial, shareware, etc links - please! I would like to hear about how you would go about writing this type of system and what approachs you would take, and possibly the TCP IP messaging architecture you would use. Whether it be straight Winows API, Indy components, etc, etc.
If this is Windows only, and you don't want to use 3rd party libraries, then you can skip TCP/IP and go for Mailslots.
Edit: if you want guaranteed delivery, than named pipes is a better solution. This SO question has a few nice answers with Delphi named pipe examples.
A mailslot is a mechanism for one-way
interprocess communications (IPC).
Applications can store messages in a
mailslot. The owner of the mailslot
can retrieve messages that are stored
there. These messages are typically
sent over a network to either a
specified computer or to all computers
in a specified domain. A domain is a
group of workstations and servers that
share a group name.
They don't need a Windows domain, they work over a LAN.
DelphiPages has a nice run-down on doing IPC in Delphi, including mailslots.
--jeroen
If you want save yourself some work and use ready solution:
0MQ
STOMP
AMQP
XMPP
in above order. Last two listed rather in informational purposes.
IMO 0MQ it's best bet - it's well-thought-out, lightweight, fast and reliable.
Looks like publish-subscribe messaging. kbmMW offers one.
There's an instant message client from Aid Aim:
http://www.aidaim.com/products/msgcommunicator/manual_instant-messaging-im-sdk/index.php
About using indy, such as in this demo: indy10clieservr.sourceforge.net OR using the TServerSocket and TClientSocket package
-> now with x64 demo sample from INDY
To get this working reliably is more work than you might think - about 5% effort to get it working, and 95% effort to ensure it works under all circumstances, including network dropouts, etc. If you go here (http://www.csinnovations.com/framework_delphi.htm) you can see how I implemented my inter-process communications framework. The TCP stuff comprises about 10,000 lines of code using the Indy components.