WAN/GAN IM application in VB.net - vb.net

Hi I have started a project which connects to a database and creates/logs in a user at the moment i have a LAN messenger that works very well, and a FTP chat which is not exactly what i was hoping for.
my idea now is to create two tables in the database message 1 and message 2 both of which display the user who is sending and the message sent. and the program uses threading to connect and download the messages.
My question is, is there a better way of completing this task (if so could you send a link or two this way? or express your opinion).
and or any problems you guys/girls think i would run into. Cheers :D
If you require to see some code just ask and i'll edit the post thanks

Although its easy on paper to do a chat application that uses a 'DB' as a backend/comms layer .. its not really the best approach. It will work... but with load, it may not be a very good approach.
Most chat clients uses a peer to peer connection, or even client server with the coding and implementation of a server that handles what happens with messages going/destined where ever.
If you really want to get low down and dirty, google for 'TCP chat application' examples. If you want to operate a bit higher (not handle the really gritty low down mechanics), then look for some 'wcf chat' examples.

Related

Videocast throught WebRTC for Hololens 2 project

I have an assignment to display, into a Hololens 2 (Unity Project), two video feeds (stereo camera) coming from a LattéPanda. For now, I successfully manage to do the demo from the Mixed-Reality WebRTC project locally, but I have some difficulties with the remote streaming.
The problem is how to make my application based on the Mixed-Reality C# Core 3.1 connect to my NodeDSS signaler since the demo uses a NamedPipeSignaler class that can't reach out to localhost? So I look up the classes they provided in the hope of getting the required method to implement, also with the interaction it needs to do with the PeerConnection object. It started to be a little complicated, so we look up other solutions.
One of the solutions we found was the OWT-Server (Open WebRTC Toolkit) which seems to give us already dockerize application to videocast on its own. However, the documentation doesn't specify much other than we need to link the docker image to an "application", which is not clear what it is supposed to do. We don't have any way to specify the STUN/TURN server, nor the signaler IP address for that matter.
So my goal at this point is very simple: just make one feed appear into my Unity project. The LattéPanda's only objective right now is to cast the video without caring much for any interaction (for now): it won't receive or even need to listen to any feed coming back ever, and for now, there is no need to interact with other tools. I've been searching for about 2 weeks now and my GoogleFu is not that good apparently. Is there any tool that could achieve this?
A little disclaimer: I do believe I still lack an understanding of the Signaling process. It seems that WebRTC does not enforce any standard in that regard. What I understand is the communication protocol (WebSocket, HTTP/2) is not standardized, only the messaging is (what message needs to be sent/handle).
EDIT
To be clear, the LattéPanda currently runs a console application written in C# Core 3.1. The reason is, like I said, that the LattéPanda should not display any of its feed to a monitor connected to it, nor received/handle any feed from outside. We can see it like a surveillance camera that outputs its feed through WebRTC and doesn't need to receive any feed.

trigger a function when changes in the DB are being commited

I was always wondering if it's possible to create a block of code (probably php code) that will execute when a certain change is being committed to the database.
For instance, chat application. When a user sends a message, it will add a message to a table, then I would like to force all of the other users to an AJAX request to read this new value (rather than sending AJAX request every 100ms to check if there is a new message)
I remember something that involved node.js and some other type of DB rather than mysql. If this is the only solution, can it work along with a normal mysql database?
Thanks in advance!
Yes, MySQL supports triggers, but they are pretty much limited to do other data operations. So you'd still have to get some notification sent to your javascript client
A better way of doing client notifications with with websocket or comet, allowing the server to push notifications from a message-queue.
You didn't give much detail about your programming environment, so I'll leave it to you to follow the tag links I gave above, and research the appropriate tools and frameworks for using these general methods.
Re your comment:
For PHP, here's an example "push" chat application:
http://www.aljtmedia.com/blog/websockets-for-php-ratchet-push-chat-application/
Here's an primer on using message queues in general:
http://blog.thecodepath.com/2013/01/06/asynchronous-processing-in-web-applications-part-2-developers-need-to-understand-message-queues/
And here are tutorials for RabbitMQ (one simple option among many MQ solutions usable by PHP), including PHP examples: https://www.rabbitmq.com/getstarted.html

Real-time application newbie - Node.JS + Redis or RabbitMQ -> client/server how?

I am a newbie to real-time application development and am trying to wrap my head around the myriad options out there. I have read as many blog posts, notes and essays out there that people have been kind enough to share. Yet, a simple problem seems unanswered in my tiny brain. I thought a number of other people might have the same issues, so I might as well sign up and post here on SO. Here goes:
I am building a tiny real-time app which is asynchronous chat + another fun feature. I boiled my choices down to the following two options:
LAMP + RabbitMQ
Node.JS + Redis + Pub-Sub
I believe that I get the basics to start learning and building this out. However, my (seriously n00b) questions are:
How do I communicate with the end-user -> Client to/from Server in both of those? Would that be simple Javascript long/infinite polling?
Of the two, which might more efficient to build out and manage from a single Slice (assuming 100 - 1,000 users)?
Should I just build everything out with jQuery in the 'old school' paradigm and then identify which stack might make more sense? Just so that I can get the product fleshed out as a prototype and then 'optimize' it. Or is writing in one over the other more than mere optimization? ( I feel so, but I am not 100% on this personally )
I hope this isn't a crazy question and won't get flamed right away. Would love some constructive feedback, love this community!
Thank you.
Architecturally, both of your choices are the same as storing data in an Oracle database server for another application to retrieve.
Both the RabbitMQ and the Redis solution require your apps to connect to an intermediary server that handles the data communications. Redis is most like Oracle, because it can be used simply as a persistent database with a network API. But RabbitMQ is a little different because the MQ Broker is not really responsible for persisting data. If you configure it right and use the right options when publishing a message, then RabbitMQ will actually persist the data for you but you can't get the data out except as part of the normal message queueing process. In other words, RabbitMQ is for communicating messages and only offers persistence as a way of recovering from network problems or system crashes.
I would suggest using RabbitMQ and whatever programming languages you are already familiar with. Since the M in LAMP is usually interpreted as MySQL, this means that you would either not use MySQL at all, or only use it for long term storage of data, not for the realtime communications.
The RabbitMQ site has a huge amount of documentation about building apps with AMQP. I suggest that after you install RabbitMQ, you read through the docs for rabbitmqctl and then create a vhost to experiment in. That way it is easy to clean up your experiments without resetting everything. I also suggest using only topic exchanges because you can emulate the behavior of direct and fanout exchanges by using wildcards in the routing_key.
Remember, you only publish messages to exchanges, and you only receive messages from queues. The exchange is responsible for pattern matching the message's routing_key to the queue's binding_key to determine which queues should receive a copy of the message. It is worthwhile learning the whole AMQP model even if you only plan to send messages to one queue with the same name as the routing_key.
If you are building your client in the browser, and you want to build a prototype, then you should consider just using XHR today, and then move to something like Kamaloka-js which is a pure Javascript implementation of AMQP (the AMQ Protocol) which is the standard protocol used to communicate to a RabbitMQ message broker. In other words, build it with what you know today, and then speed it up later which something (AMQP) that has a long term future in your toolbox.
Should I just build everything out with jQuery in the 'old school' paradigm and then identify which stack might make more sense? Just so that I can get the product fleshed out as a prototype and then 'optimize' it. Or is writing in one over the other more than mere optimization? ( I feel so, but I am not 100% on this personally )
This is usually called RAD (rapid application design/development) and it is what I would recommend right now. This lets you build the proof of concept that you can use to work off of later to get what you want to happen.
As for how to talk to the clients from the server, and vice versa, have you read at all on websockets?
Given the choice between LAMP or event based programming, for what you're suggesting, I would tell you to go with the event based programming, so nodejs. But that's just one man's opinion.
Well,
LAMP - Apache create new process for every request. RabbitMQ can be useful with many features.
Node.js - Uses single process to handle all request asynchronously with help of event looping. So, no extra overhead process creation like apache.
For asynchronous chat application,
socket.io + Node.js + redis pub-sup is best stack.
I have already implemented real-time notification using above stack.

Sample Code for Remote Process/Application Monitoring

All
I am looking for a bit of inspiration here, a client has requested me to build a simple remote process monitoring application with capability for smtp notification, when monitored processes go down or come back on-line. Can anyone point me in the direction of some sample code to get me started. I have briefly looked at .net remoting as a potential development path, from my understanding of how this works, the remoting architecture would require both a client and remote server component, (though I am not a 100% sure on this one), however if this is the case, then it will not fit the bill, as one of the fundamental requirements is that no additional software can be deployed on the servers which are to be monitored.
Alternatively, if you know of a finished 'lightweight' product out there, which would deliver this sort of functionality then this would probably work as well.
Kind Regards
Paul J.
Net-SNMP actually has the ability to monitor processes and send out notifications now. If you look in the snmpd.conf manual page (http://www.net-snmp.org/docs/man/snmpd.conf.html) under "process monitoring" (http://www.net-snmp.org/docs/man/snmpd.conf.html#lbAR) and "disman event-mib" support (http://www.net-snmp.org/docs/man/snmpd.conf.html#lbAX) to get the two features you need. Also the notification sending support (http://www.net-snmp.org/docs/man/snmpd.conf.html#lbAW).
I don't remember the windows support for it and how well it works though (it looks like you're aiming for windows).

Socket programming and telnet with VB.net

I'm writing a GUI-based app in VB.net that talks to a LambdaMOO server via telnet, sends commands to display the object hierarchy, then parses the output and creates a visual representation of the object hierarchy.
So my question is: is there some kind of "telnet client" class for .NET to simplify the sending and receiving of data, or do I have to write my own using the socket API?
Does Mono have something like this?
Barring an easy solution, does anyone have a good tutorial they can point to for telnet client programming in VB.net?
Ok, I had a similar issue and ignoring all security complications and the like, wanted to TELNET from a VB initiated connection to a remote device and do stuff. I concur that the whole negotiation process is a hellish thing to do but once you've worked it out it's actually pretty simple to implement. I decided not to stop because I kept reading things that said it couldn't be done when it clearly can be done if you can write and read 1's and 0's into/from a network stream.
The code in the link below will initiate the connection and get you through to actually exchanging clear text information over TELNET. Given the example of sending a username and password combo shows how to read and write to the connection.
Big tips - initially have a nice big textbox or something to trap everything that comes into the buffer (variable returndata). This will help you diagnose problems. Also check on my blog there how to do this without the textbox blinking like a flashing thing. Once you've done all that and you know your script is reliable, trun off any screen updates and it will whizz through rather than take an age.
Apologies for the really dirty code and the crappy website layout.
http://myhead-online.blogspot.com/2009/05/vb-net2008-express-telnet-to-sun.html
The telnet protocol is basically just the usual TCP protocol, with a bunch of optional stuff that you probably won't need to implement. So you'd open a socket and start sending and receiving data with the socket stream interface.
Give it a try with the regular socket API, you'll probably find that it's quite straightforward.
just a suggestion. you may try to program your vb application to execute an existing telnet application in batch mode.
here is the link for your reference. refer to 7.3 Using Plink in batch files and scripts. Hope it helps.
You can grab one of any number of libraries to use. Here's one library:
LINK
For others try googling something along the lines of: library telnet mud .NET
Lastly, there are any number of opensource MUD/MOO/MUSH projects open at any time who are willing the share ideas and looking for people to help with projects.
I had my trials with telnet. You've to use tools like wireshark in conjuntion to figure out what commands needs to be initiated. I did find communicating with my unix box quite a challenge. For one thing you must know your telnet instructions. You might find it difficult to determined the state of the application - whether it is logged in or not innately. You'd have to formulate your own logic for it.
Another thing you'd have to do is parse the bytes returned by telnet into commands or instruction data i.e. you have to know if the bytes received is an instruction or some other thing it is trying to send you. Here is a ref that would come in handy.
First I suggest you start using the wireshark tool and get the communications send to and fro manually as well as via application.
From the LambdaMOO end of things, if you have wizard access or are friends with someone who does, you can have the MOO give you the data over another protocol that you might be able to work with more readily, such as HTTP. All you need is an object on the MOO with a do_login_command() set to handle requests, and then use the listen() builtin to get that object to listen on a given port. As long as a protocol doesn't require anything complex SSL, it's fairly easy to code up on the MOO end. So that might be worthwhile if VB.net has easier handling for HTTP etc.