How to access multiple attributes at the same instance using mbeans? - jakarta-mail

I have javamail program which gets size of each mail in my gmail inbox. I am accessing size using mbeans in a client program. how do i get to know which mail's size it is showing in the client program?
I need to get more than 1 value in the client program at the same instance,i.e. the mail size and the mail number. What should be done?

I don't understand the question. What do you mean which mail size? Do you mean "the size for which message"? However you're communicating the size to the client program, you're also going to have to communicate something about the message, such as its message number. More details about what you're doing might help us provide a better answer.

Related

Redirect the socket traffic on an application already executed

I am trying to understand how to change the IP/port of a socket used by an application, to get it to send its packets to me instead of the original recipient.
I saw that Frida API can help me to do that, but I want to understand how its done. Could someone explain to me how Frida is able to do that? It kind of blows my mind that it is able to slip so deeply into a program.

How to filter anonymous SIP messages / invites on Asterisk

I have a CentOS 7 installation runnning Asterisk 14.0.3.6 with pjsip enabled and FreePBX for a UI. For a new project we will have many devices in the field which will want to be able to send a sip message without registering(in a separated network with their own router) to a registered SIP client in our environment (like a message receiver). After receiving the message we want to be able to initiate a call session if necessary.
The first challenge is to filter the sip messages / invites from sources I don't want to receive anything from. My plan is to register the devices in the database and match one or more values from a specific device to the incoming messages / invites and accept or decline these based on the existing values.
I'm a beginner to C and Asterisk, installing the environment is all experience I have so far. I do know how to code since I'm a C# programmer. Now I'm looking for the c file to edit so I can filter incoming invites or messages based on an array of values but I don't know which file and function is responsible for handling this.
Any tips are greatly appreciated.
Asterisk have built-in registrator. It will refuse messages from not-registered peers automaticaly.

Send memory variables from Server to Client in open62541

I'm trying to create a bridge in C Language that uses two protocols : OPC-UA and MODBUS.
Between the client and the bridge I used the protocol open62541 to ask for some data of any type. When the bridge receive the request, the memory requests start, from the brigde with the protocol MODBUS, to the MODBUS server, that should send back those memory variable asked.
My problem is that I cannot find any way to see the point in the code, where the Server recieve the Client request.
I need to find how to send those memory variables back from the server to the Client.
I would be glad if someone has the solution.
By guessing I assume you mean a ReadRequest and you want to find out where this read request is handled in the server?
It could be this one: Service_Read
https://github.com/open62541/open62541/blob/71e9a44d1aec5bc0cce465c8daefe47883b25f6c/src/server/ua_services_attribute.c#L394
Or also the Operation_Read:
https://github.com/open62541/open62541/blob/71e9a44d1aec5bc0cce465c8daefe47883b25f6c/src/server/ua_services_attribute.c#L394
you are looking for?!

Chat server-client in C. Using threads or processes?

First of all, the environment I'm working on is Windows 7 and Visual Studio 2010.
I already wrote a server that uses the select method to retrieve data from more than one client.
Also I wrote a client that connected to the server above, by running (client.exe localhost 4444 Peter). "Peter" is the username that this user wants to use.
Now let's say we have two users connected on the server. Each of them has the ability to run the command /help. This returns some other commands that the user can use. One command of these is /listusr that returns all the users on the server.
One other command is the /talk2 and here is where my problem-question begins. I want to let the user choose to which of the other users want to talk. E.g if you want to talk to Peter, you give /talk2 Peter.
How am I going to start something like this? How will the server send the message from me to Peter (I have to add here that when a new user connects, the server saves his/her username and his/her socket number in a struct)?
Do I need to create new threads for each conversation or new processes? Can someone give me some hint or advice to continue my project? I'm little confused on how to manage at this point.
Neither. Your server should maintain some kind of data structure that matches a user id to a client socket handle. When a request comes in with the /talk2 command, the server should look up the corresponding socket handle for that userid and should simply relay that message using send().
A scalable way would be your sever is just responsible to tell both clients the IP address of the other side, and then Peter and you establish the connection so you can talk.
If you really want to have the sever transfer the conversation, you need to consider the following to gain a better scalability:
Use UDP instead of TCP
Use thread instead of process
Spawning a new process would be an ordeal for the server if the number of users interacting at a time are high. But on the other hand it will be simpler to code.
Threads do provide scalability, but then you must be extra careful in your code not to do anything silly. (For example, sending wrong chats to the wrong guys.)
Use select/poll techniques (I am not sure how they perform in the Windows environment, but it works cool with Linux.)
UDP will reduce transmission time, but I am not too sure if it's a good idea. Since you said you already have a code, it would be great pain to switch to UDP.
Just sending the address of required client is also a feasible idea. It reduces a lot of effort from the server, but now you will require dedicated clients.
Try each of them and check which one works best for you. It's a design problem, so there can't be a hard and fast solution. It will depend on the usage of your application. You may also want to use (may be you are already using) the sendto and recvfrom functions.

SMS/USSD Content Retrieval

Hi guys
I'm working on this project where I'll need to retrieve information from a database through sms/ussd, much like how you would check you credit on you mobile phone.
Would appreciate any help to head me in the right direction.
(Hope I put my question out clearly, if not ask me so I can clarify)
I can help you extensively in solving your problem. As far as I got understood what you want to achieve is, perhaps that when a SMS message comes to your GSM Modem or GSM Phone, your software should be capable enough to interpret that message according to your protocol and should respond accordingly, also when it needs to process database. This is absolutely possible. Let me describe it in brief. Following are the general steps:
You must connect your GSM Phone or Modem through your software with a particular COM port.
After assigning and configuring the port, You issue AT+CNMI=2,2,0,0,0 command to Modem, if it responds to OK, then it indicates that it supports this command, else an error is generated.
Now send an SMS from some other phone, you will see that the SMS directly goes to your software, now you can process it as per your needs.
The whole process is slightly a lengthy description, but it is possible.

Resources