Results 1 to 8 of 8
  1. #1
    blackfox is offline Member
    Join Date
    Oct 2011
    Posts
    4
    Rep Power
    0

    Thumbs down intercept a c++ IO pipeline??

    Hello,

    I dont quite know if this is the right place but since it said Synchronization i thought i'll post this here.

    for a college project i had to make 2 programs that connect to each other through sockets. a chat client/server.

    after i did this they gave me another assignment saying i need to build a GUI with java and then make it run the c++ client and intercept the I/O pipeline to read and send data.

    I looked up on the internet how to do this for a while now and there seems to be NO information regarding this problem.

    Can anyone point me in the right direction? At the moment i'm trying to figure out how to set up all of this (i have no knowledge of how to do any of what i just described). And since im getting limited guidance asking through college is gonna take a long time.

    any help is really reaaally appreciated!

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default Re: intercept a c++ IO pipeline??

    If your C++ process communicates through its streams stdin and stdout (and optionally stderr?) things are easy: in Java you can get the counterparts of those streams and read and write from/to them. Read the API documentation for the Process class. If your C++ process communicates through named pipes you can open those pipes as if they were files and read/write from/to them ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    blackfox is offline Member
    Join Date
    Oct 2011
    Posts
    4
    Rep Power
    0

    Default Re: intercept a c++ IO pipeline??

    Quote Originally Posted by JosAH View Post
    If your C++ process communicates through its streams stdin and stdout (and optionally stderr?) things are easy: in Java you can get the counterparts of those streams and read and write from/to them. Read the API documentation for the Process class. If your C++ process communicates through named pipes you can open those pipes as if they were files and read/write from/to them ...

    kind regards,

    Jos
    thanks for replying so quick Jos. i looked up some things on the internet and i use sockets (#include <WinSock2.h>) to make my connection with the server.

    would your method still be applicable? anywho im gonna try to see if ur tip leads me anywhere and i'll update you when i've figured something out.

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default Re: intercept a c++ IO pipeline??

    Quote Originally Posted by blackfox View Post
    thanks for replying so quick Jos. i looked up some things on the internet and i use sockets (#include <WinSock2.h>) to make my connection with the server.

    would your method still be applicable? anywho im gonna try to see if ur tip leads me anywhere and i'll update you when i've figured something out.
    Sockets are also easy; if your C++ process opens a socket, just make your Java process also open a socket, given a host (localhost?) and a port number and you're in business.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    blackfox is offline Member
    Join Date
    Oct 2011
    Posts
    4
    Rep Power
    0

    Default Re: intercept a c++ IO pipeline??

    Quote Originally Posted by JosAH View Post
    Sockets are also easy; if your C++ process opens a socket, just make your Java process also open a socket, given a host (localhost?) and a port number and you're in business.

    kind regards,

    Jos
    yes that would be the way i would go for but after asking my teacher he specifically told me not to use the java sockets but to "intercept the c++ program's IO pipeline" and send/receive messages through there. I'm actually starting to doubt this is actually possible due to the lack of information about this on the internet lol.

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default Re: intercept a c++ IO pipeline??

    Quote Originally Posted by blackfox View Post
    yes that would be the way i would go for but after asking my teacher he specifically told me not to use the java sockets but to "intercept the c++ program's IO pipeline" and send/receive messages through there. I'm actually starting to doubt this is actually possible due to the lack of information about this on the internet lol.
    I don't know what your teacher has in mind; better ask him/her to explain his/her intentions ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    blackfox is offline Member
    Join Date
    Oct 2011
    Posts
    4
    Rep Power
    0

    Default Re: intercept a c++ IO pipeline??

    Quote Originally Posted by JosAH View Post
    I don't know what your teacher has in mind; better ask him/her to explain his/her intentions ...

    kind regards,

    Jos
    I did and he clarified some things for me and even gave me a link to the problem i was facing!

    In case you're wondering what it was exactly i was looking for: How to run command-line or execute external application from Java | Linglom.com

    and i'll need to use JNI to call functions from within the external application.

    Thanks for your help on sockets and pipelines. I know i'll come across a situation where i'll need to apply the method u described in the posts above.

Similar Threads

  1. intercept ! SET library
    By nigamsir in forum Networking
    Replies: 0
    Last Post: 03-20-2010, 05:34 AM
  2. Finding the intercept using two equations.
    By MapleLeafRag in forum New To Java
    Replies: 1
    Last Post: 12-03-2009, 08:32 PM
  3. Intercept key type
    By carderne in forum New To Java
    Replies: 3
    Last Post: 07-23-2009, 02:57 PM
  4. Intercept CVS/SVN team commit
    By dilipg003 in forum Eclipse
    Replies: 2
    Last Post: 05-12-2009, 06:17 PM
  5. Data Pipeline Released
    By dele in forum Java Software
    Replies: 0
    Last Post: 06-28-2007, 03:29 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •