PDA

View Full Version : ApplicationMessageCenter Library


sside
03-17-2007, 05:26 PM
ApplicationMessageCenter library (ApplicationMessageCenter.dll v.1.0.0.0).
ApplicationMessageCenter library makes possible that 2 or more application to comunicate with each other. It is a 2 in 1 solution, client and server.

Actions:
ApplicationMessageCenter.Client.Connect
ApplicationMessageCenter.Client.Disconnect
ApplicationMessageCenter.Client.AddEntry
ApplicationMessageCenter.Client.RemoveEntry
ApplicationMessageCenter.Client.ExistsEntry
ApplicationMessageCenter.Client.SendMessage
ApplicationMessageCenter.Client.ReceiveMessage
ApplicationMessageCenter.Client.IsClientChannelReg istered
ApplicationMessageCenter.Client.GetError
ApplicationMessageCenter.Server.Start
ApplicationMessageCenter.Server.Stop
ApplicationMessageCenter.Server.IsServerChannelReg istered
ApplicationMessageCenter.Server.GetError

Download:
ApplicationMessageCenter.v.1.0.0.0 (http://ams5.ssideproject.com/downloads/ApplicationMessageCenter.v.1.0.0.0.rar)

Contents:
ApplicationMessageCenter.xml //Actions. Drop this to: C:\Program Files\AutoPlay Media Studio 5.0 Professional\Data\Actions.
ApplicationMessageCenter.Blank.Project.apt //Template. Drop this to: C:\Program Files\AutoPlay Media Studio 5.0 Professional\Templates.
Client1.apz //Demo. A demo project to show the ApplicationMessageCenter.dll usage.
Client2.apz //Demo. A demo project to show the ApplicationMessageCenter.dll usage.
Server.apz //Demo. A demo project to show the ApplicationMessageCenter.dll usage.

Start the server and both clients to see what it does. It is a simple project where 2 client can exchange messages with each other. When you start the server some firewalls can/will ask you for permission. Grant it if you want to see what it does, otherwise not.

Client applications can exchange messages not only from the same computer but also from lan and wan. Clients and server can be in different computer, cities, countries etc. 2 clients and a server can be in 3 different computers.

3 protocols are supported:
1-Http
2-Tcp
3-Ipc (only when the clients are in the same computer).

Server can operate in three protocols in the same time. Client only one at a time. Thus clients can connect at server at any channel assuming that server is listening for incomming calls at all channels.

It is important that the dll stays at the root dir (where the exe is).

How to use it:
How you like it. But as a rule follow this patterns:

ApplicationMessageCenter.Client.Connect(Channel, Host);

Channel: You can choose from the 3 channels Http, Tcp, Ipc.
Host: Computername for lan. Ip address for wan.
Required. This is the very first actions a client must call.

ApplicationMessageCenter.Client.AddEntry(AppId);


AppId: Any unique string value.
Optional. AddEntry is optional. It is not needded to send but to receive yes. It is a kind of message box that will be created at server where messages will be stored untill you recive them.

After you are successfully connected you can send messages.
ApplicationMessageCenter.Client.SendMessage(sender , receiver, messageText, messageData);

After you have connected and created the entry (AddEntry) you can receive (or send) messages.
ApplicationMessageCenter.Client.ReceiveMessage(rec eiver);

Messages are not defined. It is up to you to define your own messages.
Applications can exchange not only messages but also files (small files though). But right now we keep it simple and exchange only messages :)

.Net 2.0 required.

With Kind Regards
sside

johnraus
03-19-2007, 03:36 PM
This is something to Toy with :D

Thnx for sharing :cool

nic3388
06-12-2007, 12:37 PM
Can you attach this to a post as your website appears to be down, thanks.

sside
06-14-2007, 12:01 PM
With Kind Regards
sside

sside
08-21-2007, 11:13 AM
Functions:

AddEntry
RemoveEntry
ExistsEntry
GetEntries
GetEntryInfo
SetEntryStatus
SendMessage
ReceiveMessage
ReadMessage
GetMessageCount

Connect
Disconnect
IsClientChannelRegistered
GetClientError

Start
Stop
IsServerChannelRegistered
GetServerError


.Net 2.0 required

With Kind Regards
sside

Teqskater
07-24-2008, 04:36 PM
Woow ****. This is what i needed for a long time. Big big thanks :yes :lol

Teqskater
08-10-2008, 05:03 PM
Hi can somebody help me with an error. ive coded something together al week long and it works so far until i need to read a message. this is the code i use to read it.

nmsg = ApplicationMessageCenter.GetMessageCount(server);
nmsg = String.ToNumber(nmsg)
Label.SetText("Messages:", "Messages: "..nmsg.."");

if nmsg > 0 then
for x = 1, nmsg do
msg = ApplicationMessageCenter.ReadMessage(server, x) -- .Sender .Receiver .Text .Data .Time
Label.SetText("Text =", "Text = "..msg.Text);
Label.SetText("Data =", "Data = "..msg.Data);
end
end

i send a message with my client and then the server that needs to recieve that message executes the code above. Label "Messages:" text changes to "Messages: 1". then it reads it but doesnt put out anything in the labels "Text =" and "Data =" and i am 100% sure it gets to those lines:
Label.SetText("Text =", "Text = "..msg.Text);
Label.SetText("Data =", "Data = "..msg.Data);

I slightly modified the functions names only the ones like this: ApplicationMessageCenter.Server.Start changed to ApplicationMessageCenter.ServerStart (i did this to properly create an xml for the action wizzard so that it shows up there). Further i didnt move the dll or changed its name. i even tryed to get an error with some code i deleted but it doesnt return any message. I feel a bit down right now because i spend very much ours coding something and now when i get to a point that it needs to work and it doesnt. Sside or someone else can you help me please. Thanks people.

sside
08-12-2008, 05:47 AM
Teqskater

A few things i would think of:


Make sure thew server is listening.
ReadMessage index is zero bassed (for x=0).
Make sure you are sending to the correct server (check server name).


What number returns GetMessageCount? Is it bigger than 0?
If that be the case then put a messagebox inside the loop and see if sender is being displayed properly.

With Kind Regards
sside

Teqskater
08-14-2008, 07:28 PM
I found the trouble. I didnt know that the ReadMessage index was zero based. And it doesnt work with the ICP channel (no problem for me because i use ICP now). But i have another question: when you read a message it doesnt go away out of the entry? How does the recieve message function work if there are two messages or more? does it read message one for example and the next time its called message two or how does it work? Thanks for your help so far! Btw im creating a multiplayer card game with it and i think when im done i release the source code over here in the forums i think. it also has more then 10 functions that deal cards, turnover cards ETC.

sside
08-15-2008, 06:20 AM
Teqskater

Ipc channel works only for local connections. It does not work for remote connections. One example would be when the server and client are located in same computer.

ReadMesage does not remove the message.

ReceiveMessage gets you the message and removes it from the message queue (fifo). If there are more messages then call ReceiveMessage in a loop, page timer, or until returns an empty string.

With Kind Regards
sside

Teqskater
08-15-2008, 07:01 AM
Alright thanks again forgot to mention in the previous post that i was using ICP localy and it still didnt work and i was pretty sure i didnt do anything wrong. But i could be wrong. I never now because i changed the code now.

Alright it works now. I simply changed ReadMessage To Recievemessage. Now everything works. :yes

Big thanks,

Teqskater

sside
08-15-2008, 07:13 AM
Make sure then that the server is also listening in Ipc channel.

With Kind Regards
sside

Teqskater
08-15-2008, 09:03 AM
Oh forgot this. Wich ports does it use. i cant find them.

sside
08-15-2008, 07:36 PM
You don't need the port nr to connect to a server.

Here they are for your convinience:

Http channel (11771)
Tcp channel (11772)
Ipc chanel (11773)

You could run a netstat and get those numbers as well.

With Kind Regards
sside

Teqskater
08-16-2008, 02:46 PM
I know that but i need those port numbers to forward them in my router etc.

Centauri Soldier
11-15-2008, 12:57 AM
Hey sside. Just wanted to drop by and say a big thank you for the MessageExchangerDLL. :yes:yes:yes :D

After modifying the functions a bit and adding them to my action scripts, it has solved my communication problem for my LAN game I am building. I wasn't sure I was going to be able to make it over that hurdle but now I'm onto the easy stuff in my program...thanks much sside.

You saved me a heap of trouble. ;)