Its possbile. You can write the server in the language of your choice and the client in the language of your choice as long as the speak the same protocol.
For example we have a very simple Qt-App that waits on a updsocket and waits for plain textstrings. The "client" is a bashscript using netcat to send strings in the format. Very simple and works.
The command on the client side is:
netcat -u localhost 1234 "progressbar : 30"
netcat -u localhost 1234 "progressbar : 30"
To copy to clipboard, switch view to plain text mode
And the server (in Qt) has something like this:
while (_udp_socket->hasPendingDatagrams()) {
datagram.resize(_udp_socket->pendingDatagramSize());
quint16 senderPort;
_udp_socket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
processTheDatagram(datagram);
}
void ProgressWindow::processTheDatagram(const QByteArray& datagram) {
if(stringRepresentsAProgessUpdate(data)) {
//do something
}
}
while (_udp_socket->hasPendingDatagrams()) {
QByteArray datagram;
datagram.resize(_udp_socket->pendingDatagramSize());
QHostAddress sender;
quint16 senderPort;
_udp_socket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
processTheDatagram(datagram);
}
void ProgressWindow::processTheDatagram(const QByteArray& datagram) {
QString data = QString(datagram).trimmed();
if(stringRepresentsAProgessUpdate(data)) {
//do something
}
}
To copy to clipboard, switch view to plain text mode
An of couse in more complex scenarios you can also use a well known protocoll with cool features, but that depends on what you are doing.
But without C++ Experience this could be very difficult, because C++ is not so easy to handle and comfortable as Java (in my opinion)
Bookmarks