LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   telegram-cli bind: Address already in use (https://www.linuxquestions.org/questions/linux-newbie-8/telegram-cli-bind-address-already-in-use-4175553321/)

Raakh5 09-12-2015 01:32 PM

telegram-cli bind: Address already in use
 
Hello,

Code:

# su - telegram -c "cd ~/tg && bin/telegram-cli -k tg-server.pub -dWS /tmp/tg.sck &"
# bind: Address already in use

How can I know which address is already in use or which address telegram-cli is looking for? or how can I fix this problem

please advise

jpollard 09-13-2015 05:55 AM

From the documentation (https://core.telegram.org/mtproto) it looks like it is using port 80 by default.

If you have a web server running, then the address would be in use...

As for fixing it - not sure. As a server, it would have to use a known port for other clients to connect.

Raakh5 09-13-2015 06:48 AM

Thanks for your favorable reply. Yes apache is running on port 80. How can I fix this problem so that either telegram-cli listen on another port or share same port 80?

jpollard 09-13-2015 07:43 AM

Only one server may use port 80 at a time (generic). If both services are restricted to a specific network, then the one service can use port 80 on one network, and the other service can use port 80 on a different network.

But both can't be active at one time.

Now you should be able to run a virtual machine to contain one of the services - thus that VM would get a different network address. Then both services can be active at one time on a physical system.

I dont know if this will work using containers (no experience there).

Raakh5 09-13-2015 07:45 AM

Thanks again

Despite virtual machine can I use another port?

jpollard 09-13-2015 07:50 AM

If you do, all clients that use that servervice must also use that alternate port.

for example - if you switched the web server to use port 8080 (common) every web browser must specify port 8080 to connect to the web server. I use the web server for the example because I've done that before.

You would have to look into the configuration of telegram to see if you can specify an alternate port though.

Raakh5 09-13-2015 08:37 AM

Actually telegram-cli is using port 80 but with opening a different socket. I was surfing and found that link http://stackoverflow.com/questions/1...sharing-a-port which states that many sockets can be opened on one port by many users.

If this is true then how can I fix my problem

jpollard 09-13-2015 08:51 AM

Quote:

Originally Posted by Raakh5 (Post 5419748)
Actually telegram-cli is using port 80 but with opening a different socket. I was surfing and found that link http://stackoverflow.com/questions/1...sharing-a-port which states that many sockets can be opened on one port by many users.

If this is true then how can I fix my problem

This is only true for a single service. No two services can use the same socket on the same network on the same system.

It is not true for any client. A client gets a random socket. If it gets an "already in use" error, it is supposed to try another socket.

And that is what is in your URL.

Telegram is an instant messaging service. A web server is not.

BTW, from https://github.com/vysheng/tg/wiki/T...m-CLI-Commands

telegram-cli starts the tg process, which I believe is the server... and that server listens on port 80, which is in use by your web server.

I did find https://github.com/vysheng/tg/wiki/R...-CLI-as-Daemon which describes how to start telegram using an arbitrary port...

But any client that is going to connect must also use that same port number.

Raakh5 09-13-2015 09:47 AM

Quote:

Originally Posted by jpollard (Post 5419752)
This is only true for a single service. No two services can use the same socket on the same network on the same system.

It is not true for any client. A client gets a random socket. If it gets an "already in use" error, it is supposed to try another socket.

And that is what is in your URL.

Telegram is an instant messaging service. A web server is not.

BTW, from https://github.com/vysheng/tg/wiki/T...m-CLI-Commands

telegram-cli starts the tg process, which I believe is the server... and that server listens on port 80, which is in use by your web server.

I did find https://github.com/vysheng/tg/wiki/R...-CLI-as-Daemon which describes how to start telegram using an arbitrary port...

But any client that is going to connect must also use that same port number.

Great Sir, thanks from the bottom of my heart


All times are GMT -5. The time now is 11:22 AM.