socket program

noblesse.lucy의 이미지

지금 server 와 client로 메세지를 주고 받는 부분까지 완성 하엿습니다.

제가 지금 하고자 하는 프로그램은 지금 현재는 server가 있고 client가

있을때, client computer에 processe 목록을 받아올고 합니다.

10분에 한번씩 실행 시켜서 server에 전송하려고 합니다.

그런데 system 함수를 써서 리턴값을 비교해서 달라지면 전송하고

하려고 했는데 system의 리턴값은 정해져 있더군요.

shell 프로그램이랑은 연동을 어떻게 시키는 줄 몰라서요.

제가 알고 싶은건 shell을 사용하건 그냥 프로그램(C를 사용)을 사용

하여서 만들고 싶은데 ...... 달리 어떻게 해야할지 몰라서요 ;;;;

shell과 연동하면 교수님께서 쉽다고 하셨는데 어떻게 쓰는지

잘 모르겠습니다. 빠른 답변 부탁 드립니다. 자세히 알려주고

싶으시면 멜 보내주시면 정말 감사 하겠습니다.

noblesse.lucy@gmail.com

익명 사용자의 이미지

man popen

Quote:

popen is used to read and write to a unix pipe.

This function is NOT included in 'C Programming Language' (ANSI) but can be found in 'The Standard C Library' book.

Library: stdio.h

Prototype: FILE *popen(const char *command, const char *type);

Syntax: FILE *fp;
fp = popen( "ls -l", "r");

Notes:
command - is the command to be issued.
type - r - read O/P from command.
- w - Write data as I/P to command.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.