Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7741121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:56:43+00:00 2026-06-01T08:56:43+00:00

i am trying to send an Object via socket. its object Net public class

  • 0

i am trying to send an Object via socket.

its object Net

public class Net {
    public List<NetObject> objects; //= new ArrayList<NetObject>(); // place + transition
    public List<ArcObject> arcs; // = new ArrayList<ArcObject>(); // arcs - objects
}

here is the ArcObject class

public class ArcObject implements Observer  {

    public NetObject o1;
    public NetObject o2;
    public String parameter;
}

and here is NetObject class

public class NetObject implements Observer{
public int index; // index of object
public int type; // type - place=1, transition=2 ...
public int x; // position
public int y;
public List<Integer> tokens ; //list of tokens
//public List<ArcObject> arcs = new ArrayList<ArcObject>();
public String guard;
// etc... 
}

then i connect to the server

        String computername=InetAddress.getLocalHost().getHostName();
        kkSocket = new Socket(computername, 4444);
        OutputStream outputStream = null ;
        ObjectOutputStream  out = null ; 
        outputStream = kkSocket.getOutputStream();  
        out = new ObjectOutputStream(outputStream);  

and then i try to send object via socket

out.writeObject(petriNet); //petriNet object is from class Net

but the client gives me an exception

java.io.NotSerializableException: petri.ArcObject

but ArcObject class cant implements Serializable, since it already implements Observer, so how am i supposed to send object via socket which has two lists included.
any ideas ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:56:44+00:00Added an answer on June 1, 2026 at 8:56 am

    You’re allowed to implement multiple interfaces. Just comma-separate them in the declaration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using asp.net mvc2 and trying to send a list of json objects with
I'm trying to send an object of a custom class through my asmx webservice
I`m trying to send e-mail via c# and use the following code: public static
i am trying to aggregate form elements into object and then send it via
I'm trying to send an array of objects wrapped in an array object wrapper
Happy coding weekend to everyone!!!. I'm stuck trying to send a JSON object via
I am trying to send object's array to Spring controller via jQuery AJAX. Here
I am trying to send an object across GWT RPC (GWT 2.4). The object
I am trying to send objects over sockets in android emulators. Each emulator sends
I'm trying to send a post request to Parse: https://parse.com/docs/rest#objects-creating . Can't get it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.