views:

55

answers:

2

Hi to all network programming gurus. I feel an urge to write my own video chat system based on RTMP protocol. Of course I know C a little but I don't know yet network programming, I'm just learning it. And I'd like to ask where exactly I have to "dig", how to design my program (for *nix) to make it process a lot of connections. And I'd like to know how much time it can take me to realize such a program? I know, it's maybe a silly question to ask, but I want to know about other programmers experience: how much time they spent to to become a good network programmer or to write something similar. Any help will be greatly appreciated.

+1  A: 

Here's three things you need to read about:

  • Sockets (man socket)
  • select -command (man select)
  • RTMP protocol. (wikipedia seems to tell there's three variations from it)

Additionally you need to know some video chatting details. But those are good starting points.

You might find some additional socket programming examples in google. Though maybe it's best you'll step in one-by-one.

First make a server application like this:

sock = socket(AF_INET, SOCK_STREAM)
sock.bind((hostname, port))
sock.listen(5)
client, address = sock.accept()
while(true){
    print client.recv(4096)
}

And a client application like this:

sock = socket(AF_INET, SOCK_STREAM)
sock.connect((hostname, port))
client.send("just some text to show out\n")

read the documentation of select, recv and send carefully through before use!!!

Cheery
A: 

OK, I'll take it into account. I walked through some forums and saw there discussions about using fork or thread for Unix servers. So what is better (for performance) to use in your opinion?

Mra