[sip-comm-dev] Some questions seem to be stupid


#1

Hi, everyone!

I have several questions looking for your answers as follows:

1. Since sip-communicator can support multi IM protocols, when it receives a
package, how can it tell which IM client to send to? according to the port
number? But as far as i know, sip-communicator should have just one port for
receiving msg. this is ok for sending msg to different IM clients 'coz it is
aware of which one to send to, but when msgs from different clients are
coming, how could it tell one from the others and is there any port mapping
or other mechanism to solve this problem?

2. I got the info on internet that nowadays most of IM software are based on
TCP connection. But TCP is a stream oriented transportion layer protocol,
which method in java could devide the stream into protocol package?

3. Now what i want to do is to unpack a package of protocol A, extract the
msg from it and pack it into a package of protocol B, to realize msg
transmission between different clients. I am wondering whether there is any
API in java that could help me do this.

thx alot if you guys could help me and good luck to all:)

Best regards,
Donald


#2

Hello Donald,

赵晨新 написа:

Hi, everyone!

I have several questions looking for your answers as follows:

1. Since sip-communicator can support multi IM protocols, when it
receives a package, how can it tell which IM client to send to?
according to the port number? But as far as i know, sip-communicator
should have just one port for receiving msg. this is ok for sending msg
to different IM clients 'coz it is aware of which one to send to, but
when msgs from different clients are coming, how could it tell one from
the others and is there any port mapping or other mechanism to solve
this problem?

The different protocols in SIP Communicator are supported through
different stacks which all use different sockets. While in principle you
are right that from a programming point of view one socket would be
enough, this could hardly work in practice as it would be relatively
complex to implement without any real advantage.

Note however that the issue is outside the scope of projects like SIP
Communicator as they do not directly deal with sockets but rather use
dedicated protocol libraries to do it.

2. I got the info on internet that nowadays most of IM software are
based on TCP connection. But TCP is a stream oriented transportion layer
protocol, which method in java could devide the stream into protocol
package?

Not sure I understand your question. Indeed, with TCP you get an input
stream out of a socket, then use the read method to obtain whatever
bytes are available. If there are none, then you simply continue waiting
until something arrives.

3. Now what i want to do is to unpack a package of protocol A, extract
the msg from it and pack it into a package of protocol B, to realize msg
transmission between different clients. I am wondering whether there is
any API in java that could help me do this.

Yes, you can use SIP Communicator's ProtocolProviderService to do
exactly this.

Hope this helps
Emil

···

thx alot if you guys could help me and good luck to all:)

Best regards,
Donald

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net