powered by Jive Software

Packet Delivery

Hello

I am looking for a couple of days now on how to deliver an incoming packet on my openfire server to another destination (i.e. different port and ip) as well

I tried Debugging and following the packet from the moment it was read from the socket until it was deliverd to its destination

and for some reason I can’t find the exact piece of code where the packet is being distributed.

For that purpose I downloded the mina apache server and attached its code to my openfire code

I tried everything and I can’t seem to find a way to it

All I need is to duplicate each packet the is received by my server and send it to another port on another ip as well

so it will be send to different destinations, one is the target users that the message is suppose to go to and another destination of my choice

Any help would be appreciated, if anyone can direct me to that piece of code I’m looking it would be great

Thanks

P.S - My openfire version is 3.6.3

Hello,

If you’re looking to re–route a packet you could write a plugin that implements the PacketInterceptor interface. Once that packet has been intercepted you could open up a socket connection and send the contents of the packet to a client. For code samples you could look at the Openfire source to the Content Filter, Packet Filter or Subscription plugins.

Hope that helps,

Ryan

Hey

First of all thanks a lot for your answer!

I thought about this idea but I am pretty new to this and java overall …

I am using eclipse to run my openFire, can u please direct me on what to do ??

Do I need to implement the interface? after I do where should I make the change so it will actually read it …

and about the socket … I read a little bit about mina … should I use their interface to bind a socket and send or should I use the

regular library for the task

thanks a lot again!

Hello,

I don’t want to discourage you but if you’re not familiar with Java (or any other type of software) development trying to jump right into writing a plugin is going to be challenging. That’s not to imply that writing plugins is all that difficult but most people find it easier to crawl before they try to walk. Having said that, below are two links that you can look at that should help you get up and running:

Good luck,

Ryan

Hey Ryan!

First of all thanks a lot for your help … I have been following you posts around the community in the last couple of days and they were very helpful.

I am new to OpenFire eclpise and Java … I come from the .Net world so I do have my experience :slight_smile:

writing a plugin is a great Idea! … I will do so … my problem is setting up the environment to write it and if I should use the mina framework for the socket binding or just use the common library … I don’t want to reduce the speed and efficiency of openfire.

I saw some posts from you on how to setup the environment but they were not about eclipse … if you could direct me I would much appreciate it!

And another small question … can I just take the packet filter plugin that came with the source code and change what I need ?? if yes how do I build it afterwards

Thanks A lot!!

Ok so I managed to write a plugin … now all I need is to open a socket and send the packet

I got the packet adress and port … all I need is to send it

I want to use mina becuase it would be fast and reliable … but I have now clue what to do

I know that SocketSessionImpl class does the job but to get it instanciated I need to have lots of other stuff as well

all I want it to bind to a socket send and than close it! … can anyone help ??

Thanks!

Hello,

It’s good to hear you’re making progress…

Are you wanting to send an xmpp packet to a client that is already connected to Openfire or are you trying to send the data over just a standard Java socket?

Thanks,

Ryan