LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-12-2015, 02:32 PM   #1
Raakh5
Member
 
Registered: Mar 2012
Posts: 167

Rep: Reputation: Disabled
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
 
Old 09-13-2015, 06:55 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
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.
 
Old 09-13-2015, 07:48 AM   #3
Raakh5
Member
 
Registered: Mar 2012
Posts: 167

Original Poster
Rep: Reputation: Disabled
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?
 
Old 09-13-2015, 08:43 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
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).
 
Old 09-13-2015, 08:45 AM   #5
Raakh5
Member
 
Registered: Mar 2012
Posts: 167

Original Poster
Rep: Reputation: Disabled
Thanks again

Despite virtual machine can I use another port?
 
Old 09-13-2015, 08:50 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
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.
 
Old 09-13-2015, 09:37 AM   #7
Raakh5
Member
 
Registered: Mar 2012
Posts: 167

Original Poster
Rep: Reputation: Disabled
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
 
Old 09-13-2015, 09:51 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Quote:
Originally Posted by Raakh5 View Post
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.

Last edited by jpollard; 09-13-2015 at 09:59 AM.
 
1 members found this post helpful.
Old 09-13-2015, 10:47 AM   #9
Raakh5
Member
 
Registered: Mar 2012
Posts: 167

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:443 bruvajon Linux - Software 34 11-30-2011 04:08 PM
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listen jsaravana87 Linux - Server 1 11-25-2011 11:45 AM
Program to assign globa lIPv6 address and bind() to the previously assigned address. mwnn Linux - Networking 2 10-07-2010 03:29 AM
Bind IP address with MAC address in squid 3 ( Source baced) gulnawaz Linux - Server 3 01-14-2010 02:25 AM


All times are GMT -5. The time now is 04:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration