Thread: Forking Issue...

  1. #1
    #C-help
    Join Date
    Jun 2007
    Location
    Las Vegas
    Posts
    53

    Forking Issue...

    Hey guys. Long time no see. I was off the boards for about a year now. I hope I made some progress since last year(concerning C programming).

    I wanted to write an Encrypted Chat System(p2p) and I did. But, I encountered major problems. To begin with, I know I should have used threading(not forking) for this...but I am learning threads now. I wanted to get this done faster and forking(with though less efficient) seemed to be the best way to do it(at least to me, it did). I managed to get it working, but the interface is messed up. It is very messy and it prints the messages in combination with the system messages.(they are all scrambled. I would be very thankful if you had the posibility to compile the program for me and see what I am talking about). I know I could use ncruses library to make an interface for it or even java(swing/awt)(IDK GTK), but I prefer to make it "pure" command line. So if there is any way to make the messages stay on sync and be arranged nicely...I would be very pleased.

    Here is the source code: http://rafb.net/p/Gnb5jE30.html

    I know there are some useless lines and the code is very bad...but I will organize it and remove the useless lines.
    <<deleted because of colour and size abuse>>

  2. #2
    FOSS Enthusiast
    Join Date
    Jun 2008
    Posts
    64
    there are some issues with it.

    First, I need the ECScrypt.h for compiling.
    Second, for connect(), bind() and accept() the second argument is a struct sockaddr* so you need typecasting.
    In your case it'd look like this:
    Code:
    connect(clisock, (struct sockaddr*)&clisock_addr, addrlen)
    For the other two, the typecasting is (of course) the same.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Some weird issue.
    By dbzx in forum C Programming
    Replies: 7
    Last Post: 04-12-2009, 04:10 PM
  2. float calculation issue
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-26-2008, 04:56 AM
  3. type safe issue
    By George2 in forum C++ Programming
    Replies: 4
    Last Post: 02-12-2008, 09:32 PM
  4. Replies: 8
    Last Post: 01-17-2006, 05:39 PM
  5. my first issue of GDM
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 09-12-2002, 04:02 PM