Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
R
RMI-Lab
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mohamadbashar.disoki
RMI-Lab
Commits
c5192b5e
Commit
c5192b5e
authored
Nov 13, 2025
by
Mohamad Bashar Desoki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EX2
parent
b027371d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
2 deletions
+59
-2
Client.java
src/main/java/org/ds/EX2/client/Client.java
+21
-0
CalculatorSVCImp.java
src/main/java/org/ds/EX2/server/CalculatorSVCImp.java
+21
-1
Server.java
src/main/java/org/ds/EX2/server/Server.java
+11
-0
ICalculator.java
src/main/java/org/ds/EX2/shared/ICalculator.java
+6
-1
No files found.
src/main/java/org/ds/EX2/client/Client.java
View file @
c5192b5e
package
org
.
ds
.
EX2
.
client
;
import
org.ds.EX2.shared.ICalculator
;
import
java.rmi.NotBoundException
;
import
java.rmi.RemoteException
;
import
java.rmi.registry.LocateRegistry
;
import
java.rmi.registry.Registry
;
public
class
Client
{
public
static
void
main
(
String
[]
args
)
{
Registry
registry
=
null
;
try
{
registry
=
LocateRegistry
.
getRegistry
(
1099
);
ICalculator
calculator
=
(
ICalculator
)
registry
.
lookup
(
"CalculatorSVC"
);
System
.
out
.
println
(
"Addition: "
+
calculator
.
add
(
10
,
5
));
System
.
out
.
println
(
"Multiplication: "
+
calculator
.
multiply
(
10
,
5
));
}
catch
(
RemoteException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
NotBoundException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
src/main/java/org/ds/EX2/server/CalculatorSVCImp.java
View file @
c5192b5e
package
org
.
ds
.
EX2
.
server
;
public
class
CalculatorSVCImp
{
import
org.ds.EX2.shared.ICalculator
;
import
java.rmi.RemoteException
;
import
java.rmi.server.UnicastRemoteObject
;
public
class
CalculatorSVCImp
extends
UnicastRemoteObject
implements
ICalculator
{
protected
CalculatorSVCImp
()
throws
RemoteException
{
}
@Override
public
int
add
(
int
a
,
int
b
)
throws
RemoteException
{
return
a
+
b
;
}
@Override
public
int
multiply
(
int
a
,
int
b
)
throws
RemoteException
{
return
a
*
b
;
}
}
src/main/java/org/ds/EX2/server/Server.java
View file @
c5192b5e
package
org
.
ds
.
EX2
.
server
;
import
java.rmi.RemoteException
;
import
java.rmi.registry.LocateRegistry
;
import
java.rmi.registry.Registry
;
public
class
Server
{
public
static
void
main
(
String
[]
args
)
throws
RemoteException
{
Registry
registry
=
LocateRegistry
.
createRegistry
(
1099
);
CalculatorSVCImp
calculatorSVCImp
=
new
CalculatorSVCImp
();
registry
.
rebind
(
"CalculatorSVC"
,
calculatorSVCImp
);
System
.
out
.
println
(
"Server Ready"
);
}
}
src/main/java/org/ds/EX2/shared/ICalculator.java
View file @
c5192b5e
package
org
.
ds
.
EX2
.
shared
;
public
interface
ICalculator
{
import
java.rmi.Remote
;
import
java.rmi.RemoteException
;
public
interface
ICalculator
extends
Remote
{
public
int
add
(
int
a
,
int
b
)
throws
RemoteException
;
public
int
multiply
(
int
a
,
int
b
)
throws
RemoteException
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment