• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java net BindException:Address already in use: JVM_Bind

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I've written a client/server program to start matlab on the server and its working fine and also written another client/server program to transfer files from client machine to server.Both these programs are working fine when they are executed separetely.Now, I combined these 2 server programs into one and when i try to run the application, it throws me with the following error:
Java.net.BindException:Address already in use: JVM_Bind.
I guess this is because both the server programs are listening on port 1234.If I change the port in the MatlabRCServer program, I'm able to transfer a file and when I try to start matlab, the client application hangs up.I had to quit forcibly.
Any ideas where the code is messed up???
Thanks in advance.

The following are the 2 separate server programs:
server program to start matlab

server program to send a file

[ February 12, 2004: Message edited by: kimi lynn ]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by kimi lynn:

I guess this is because both the server programs are listening on port 1234.


You are correct. As for your other problem, I think you posted the same code twice.
 
kimi lynn
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Joe, sorry as I posted the same code twice.Now, I'm listening on different ports and now the service is waiting for the client to connect.But, Unfortunately when i try to run the matlab on the server, it does'nt respond and the client application also hangs up.As I said in my previous post, If i run alone matlabrcserver program and try to start the matlab on the server, it works fine.BUt, when i run the tcp server which is a mix of both the server programs, the application hangs up.
Any help??
I edited my first post.
Thanks in advance everybody.
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am detecting a bit of confusion about how to use sockets. Are you trying to set any of your programs to use the same socket as the matlab server? That would cause the same bind problem you experienced before. If you are trying to connect to the matlab server, you should use a java.net.Socket.
Are you attempting to connect one of your classes to another via a socket? If that is the case, the "server" should declare a java.net.ServerSocket, which listens on a port and the "client" should use a java.net.Socket to connect to the server's port.
Also it may help those of us in the peanut gallery if you would name your classes with more expressive names. Two of them are named "tcpServer" and while they have small differences, I cannot divine the purpose of those classes from the code.
Maybe a look at the Custom Networking tutorial would help?
 
kimi lynn
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Joe,
let me explain you clearly what exactly am trying to do.At first, I run the matlabserver program and then when i try to run the matlab on the server, it works fine.NOw, I run the file server program and try to send a file from the client.The file is getting through.So,when I test these 2 server programs separately, both are working fine for me.Now, all I want to do is to make "ONE" server program so that either I can start matlab on the server or I can send files from client to server using my GUI.
Here are the 2 server programs:
Matlab Server Program

File Transfer Server Program

and heres my client code:

I'd be glad if you/somebody can help me.
Thanks once again.
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pardon me if I seem dense, but you are still leaving out some details. Where is the client that corresponds to MatlabRCServer? Also, you are showing us the code that works and not your "ONE" server that does not work, right?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic