Hey, i am currently creating a client/server chat but for some reason when i go to test it, it keeps saying
Run -time error '10048'
Address in use
Would anyone know how to sort this?
Printable View
Hey, i am currently creating a client/server chat but for some reason when i go to test it, it keeps saying
Run -time error '10048'
Address in use
Would anyone know how to sort this?
Make sure your server listening port is different then your client socket port if you're running them on the same server
For example if you have a winsocket listening for incoming connections on port 1234 then don't have the client use port 1234 either. I hope this make sense.
It doesn't. You can always let a client listen to an in-use port. Take for example webservers, they're bound to port 80, yet if you open up a browser on the same pc it'll work just fine despite the fact that it also recieves on port 80.
Address in use sounds more like a problem with memory-allocation, though I'm not skilled enough in VB to be certain. Try disabling parts of your code to figure out where exactly the error occurs (that is, if your editor doesn't tell you already).
You can't have more than one socket bound to a port.
...and we can't help you any more than that if you don't provide CODE and a more detailed description.
Wrong.
a browser connects on port 80, it isn't listening for a connection on that port.
It just simply uses UDP Sockets to allow the transfer of data to take place.
Address in use is indeed about the port being bound already, therefore there is another process already listening for connections on this port.
(Trust me i've had 4~ years of pure VB6 coding)
He said HTTP SERVER not browser.
They DO listen on port 80.
Did you fail your CISCO course?
UDP is NOT used for HTTP because it's a so-called "insecure protocol" because it has no error checking.
TCP is used for data transfer.
UDP MIGHT be used by your DNS, though it can be TCP as well.
Browsers still use UDP ports per site connection, otherwise the TCP would be flooded with single connection gateways and just plain suck.
And thats the reason i was stating the browsers ^Quote:
Take for example webservers, they're bound to port 80, yet if you open up a browser on the same pc it'll work just fine despite the fact that it also recieves on port 80.
The HTTP Server is the only proccess listening for connection on port 80, the web browsers are simply connecting using that port and are not bound to it in any shape or form.
I never said they were :wink:
If you read the topic it's about a client / server application, a browser / webserver is a good example of such a combination where the one is listening on the same port the other is connecting on - an example I used to illustrate that you can have a client conecting on the same port a server is listening on. YukiNeko has a point where sockets are concerned of course, but the topicstarter never said that was the case here.
Yeah you're right in that respect BUT my posts were taking the error into account which is Address in use meaning that some other server is using this port knowingly or otherwise and that is the reason the error came up!
So trying to stay on topic as much as possible here the error in Vb6
is only caused when that port is already binded!
The error was the thing that states this is indeed the case :pQuote:
but the topicstarter never said that was the case here.
*sigh*
No, the SERVER process binds to port 80 and listen()s on it. Your browser will bind to a DIFFERENT port, above 1024, and that port number is usually of little importance to the client; just do netstat -a -n while loading RaGEZONE, for example, and you'll see several connections to RZ's IP:80 and on the other end, 127.0.0.1 (or whatever local IP your connection happens to be) with port numbers above 1024.Quote:
Take for example webservers, they're bound to port 80, yet if you open up a browser on the same pc it'll work just fine despite the fact that it also recieves on port 80.
1. A browser could theoretically statically bind to port 80, but in practice, it doesn't, both for security reasons and to allow multiple connections -- see explanation above and Wikipedia articles (cited below).Quote:
a browser connects on port 80, it isn't listening for a connection on that port.
It just simply uses UDP Sockets to allow the transfer of data to take place.
2. Complete rubbish.
This is the only thing you've posted that's true. After I already posted that.Quote:
Address in use is indeed about the port being bound already, therefore there is another process already listening for connections on this port.
Boasting about your "experience" in "VB6" does not make you any more knowledgeable at networking.Quote:
(Trust me i've had 4~ years of pure VB6 coding)
Complete rubbish. Taking random phrases from networking articles and attempting to appear "knowledgeable" by posting them only shows your ignorance and reluctance to actually LEARN about the topic. You might fool someone that doesn't know a thing at all about networking, but noone else is going to fall for it. "flooded with single connection gateways"? What the bloody hell indeed.Quote:
Browsers still use UDP ports per site connection, otherwise the TCP would be flooded with single connection gateways and just plain suck.
No they are NOT using the port, they are using some other port chosen by the TCP/IP stack. (See above.) Also, a socket cannot be used to send or receive data over TCP if it is not bound to a specific port.Quote:
the web browsers are simply connecting using that port
That is what is called a "connection". s/can/MUST/Quote:
you can have a client conecting on the same port a server is listening on.
Internet protocol suite - Wikipedia, the free encyclopedia
Transmission Control Protocol - Wikipedia, the free encyclopedia
User Datagram Protocol - Wikipedia, the free encyclopedia
TCP and UDP port - Wikipedia, the free encyclopedia
Read and learn before attempting to refute any of my points.
Ohh uhh so username1... Whats the fix to his problem then? :wink2:
Alls I see is you totally pwning the idiots and from what I make of it... Its hilarious.
and I kinda want to know because my laptop is doing the same crap >.<
and I know absolutely nothing on networking, so flame me all you want about it.
Hello,
Like guys said that port some software already listening and you trying to listen already listened port, here is enought in your program to work not so correct with sockets to get Address in use error, for example when you closing program you allways must close all opened/listened sockets! not matter or happen some error or exception!
If you run your program from VB6 developenent enviroment and then stop program from same enviroment then your program don't close they too & i think you leave then that socket in listening mode (but i am not sure, no vb in PC at the monent).
And here is enought to run one your application instance and if then you run another one you get this error too! Just check your processes with windows Task Manager maybye some program instance still in memory, maybye you need code in your program to prevent to run more then one application instance and when you try to run another server instance just activate first, then you must check which application instance already are.
Another thing like guys said here is big possibility then other software in your PC listenint this port, then you can check it with netstat or with sysinternals utility TCPView, i recommending this utility because then you see which application use which ports and what status of port and you can kill they from that utility too, is very possible then you got some example from internet with some typical service with typical port like HTTP 80 usage and maybye in your PC already started IIS on this port or something else like Apache or Tomcat.
What your chat architecture ? If you want to make TCP based chat you need to write 2 programs:
1 - Server, only server listens sockets (run only one instance of it!);
2 - Client, client only connecting (NOT LISTENING ANY PORT) to server and you can run as many as you designed instances of it! Just if you try to write 1 app with both client and server functionality and you test it on same PC you allways will get this error ;)
If you want to have less problems with your chat just write all in UDP, i remember some time ago done something like UDP Broadcast chat with RTF format support to use in small LAN, for example work or small lan at home in this way i don't needed any server just client whic broadcast in subnet like 255.255.255.255 then just if you send something you receive it too ;)
BTW:
1. HTTP can use 80 UDP port too, not only TCP (check this: http://www.iana.org/assignments/port-numbers)!
2. Ports can be in 0-65535 range and better to use port in 60000+ range and never at 0-1024 range - this is system reserved port numbers!
Good Luck!