PDA

View Full Version : UNIX C Sockets programming help



BLiTzER
05-12-2004, 00:25
Mpe. Exo ergasia na paradoso AYRIO ki epeidh eimai giatompoutso, an mporei kaneis na voithisei, tou xrostao :P Otidhpote mporeite na prosferete mou kanei. Thanks :)

Loipon me liga logia, thelei ena server pou metadidei news headlines meso internet. Oi clients dexontai ta nea, mono an einai syndromhtes sto service kai epilegoun an theloun na doun mono NEA headlines h OLA ta headlines apo thn teleytaia fora pou ekanan login. Epishs h epikoinonia epitrepetai MONO metaksy server/clients kai oxi metaksy ton clients.

O kodikas prepei na trexei se linux. Ego exo suse 9.1 personal, alla den exei idiaiterh shmasia. Arkei na einai C kai na einai se linux. Epishs thelei ligh theoria pano ston kodika, alla ok an exo ton kodika ta vrisko kai monos mou ayta. Ostoso an exete kayles de tha me xalousan katholou liga sxolia mazi me kodika :P

Sto telos, exei ena entelos theorhtiko shmeio. Pos mporo na tropopoihso ton parapano kodika oste: 1on na shkonei ekatommyria clients, 2on to service na einai syndromhtiko kai 3on na xrhsimopoiei ki alla formats (ektos apo sketo text), opos eikona, hxo, sms ktl. De thelei kodika edo, mono mpla mpla.

Oriste kai aytousia h ekfonhsh.


"Consider a news headline alert service running over the internet:

Each user of the service has a news client program running on their computer that receives regular news headline from a news server located somewhere on the internet. The only communication allowable in the service is between client and server, no messages should pass between clients. Only clients known to the server can receive the service. Clients should be able to request to see either only new headlines or all headlines since they last logged in.

You are required to design and implement, using the C programming language, a Sockets/Linux implementation of the service. Yoru design should include an overview of the functionality of the service, how it works and any assumptions that have been made.

Using the above service as a starting point provide an analysis of how you would improve the design to cope with the following issues:
* Scaling the service to millions of users
* Providing a pay-subscription service
* Content provided in different formats, e.g. pictures, sound clips, sms"

Deggial
05-12-2004, 00:32
Ο βασικός κώδικας για τα sockets είναι πάντα ο ίδιος. Κοίτα στις σημειώσεις εδώ: http://cgi.di.uoa.gr/~syspro/notes.html για τους κώδικες, στο κεφάλαιο για τα sockets. Πρέπει να γράψεις κάτι αντίστοιχο ή ακριβώς το ίδιο.

BLiTzER
05-12-2004, 01:00
Pssss.. ligo to koitaksa alla tha voithisei. Tha dyskoleyto vevaia ligo me ta ellhnika tou ("ypodoxes rohs"? :P). Cheers.

EDIT: Mhpos ksereis pano-kato tis 3 teleytaies erothseis? Theoria einai mono. Kai epishs to avatar sou de fainetai.

ari-m
05-12-2004, 18:42
gia sockets programming:

Richard Stevens, "UNIX Network Programming Vol 1", Addison-Wesley


RULEZ.-

BLiTzER
05-12-2004, 18:46
Megale se merikes ores paradido :P

ari-m
05-12-2004, 19:01
[zER]Megale se merikes ores paradido :P
ok. then help se 8ewritiko level.

a. scaling. Eykoli (profanis-aploiki lisi) fork() neo paidi o server gia ka8e sindesi pou dexetai (to paidi kleinei to listening socket o pateras to connected) kai kanei tin eksipiretisi to paidi. Pio diskoli, me xrisi threads kai gia periorismo twn paidiwn pou dimiourgountai, thread pool, i opoia periexei proka8orismeno # paidiwn pou mporoun na xrisimopoii8oun gia na eksipiretisoun clients.


b. Xrisi DB kai diadikasia login-authentication?

c. apostoli tis apantisis mesw http prwtokollou kai xrisi headers kai mimetypes?

BLiTzER
05-12-2004, 19:06
Den exo idea. Kai akrivos epeidh den exo idea, tha ta psakso ligo ola ayta pou les kai pithanotata tha ta xoso sthn ergasia. Ligo parapano info, gia ta 2 teleytaia esto?

Kai thank u :)

EDIT: Btw olo ayto meso tcp etsi?

ari-m
05-12-2004, 19:46
b. Xrisi DB kai diadikasia login-authentication?


Sxediasmos protokollou to opoio prepei na akolou8ei o server ki o client. Rikse mia matia p.x sto RFC 1725 (POP3) (http://www.ietf.org/rfc/rfc1725.txt?number=1725) gia na pareis mia idea enos protokollou pou metaksi allwn zitaei authentication.




c. apostoli tis apantisis mesw http prwtokollou kai xrisi headers kai mimetypes?

HTTP 1.1 (http://www.ietf.org/rfc/rfc2616.txt?number=2616)
kai

media types <- epektasi twn mime types
RFC1590 (http://www.ietf.org/rfc/rfc1590.txt?number=1590)

Me sxediasmo dikou sou prwtokollou gia tin epikoinwnia server-client, pi8anws na mporeis na xrisimopoiiseis apla xaraktiristika twn media types sto prwtokollo sou, xwris na kaneis xrisi tou http.

p.s.1. ennoeitai oti ola paizoun sto tcp.
p.s.2. kali epitixia ;)
p.s.3. run BLi][zER run :D
p.s.4. sorry pou den eimai poli analitikos alla afenws bariemai, afeterou kati prepei na kaneis ki esi ;) :D:D:D

BLiTzER
05-12-2004, 19:50
Cheers mate :)

Ante na katso tora.

Angrafan
07-12-2004, 14:32
ti ekanes telika?

BLiTzER
07-12-2004, 14:59
Phra ta arxidia mou.

Perimeno vathmo dld alla 99% oute vash.

minus6
07-12-2004, 16:30
[zER]Phra ta arxidia mou.

Perimeno vathmo dld alla 99% oute vash.
Την επόμενη φορά πες το μας πιο νωρίς, κάτι θα κάνουμε :)

BLiTzER
07-12-2004, 16:32
Eh nai malakisthka teleios. Epeidh eimai malakas isos.

Tespa tora apla elpizo na piaso toulaxiston vash. Allios mpampai master.

Cheers to everyone tho.

BLiTzER
09-12-2004, 21:38
Ok sas exo allo ena, gia osous exoun oreksh :P

Thelei to sxediasmo enos online systhmatos feedback gia to ekastote course. Yparxei ena erothmatologio online, kanoun login oi mathites kai to symplhronoun. Kathe mathiths mporei na symplhrosei mono ena - gia to course sto opoio einai registered - kai mesa se sygkekrimeno xroniko diasthma. Ta apotelesmata kataxorountai se excel-based database.

Epishs MONO aytos pou to symplhrose mporei na to kanei (to diko tou) modify. O mathiths profanos paramenei anonymos kai to erothmatologio tou aysthros empisteytiko (de mporei na to dei kaneis allos, ektos apo ton idio kai to systhma).

Telos, meta to peras ths dedomenhs xronikhs periodou, de mporei na symvei opoiadhpote allagh sth database, alla paramenei readable apo aytous pou epitrepetai (mathith kai systhma). Telosx2, h quality assurance team ektelei to excel-based package gia na dhmiourghsei ta reports me vash ta erothmatologia.

Kai ta zhtoumena (pera apo to genikotero sxediasmo tou parapano):

"You are required to design the Online Institutional Student Feedback Survey
System described above (you can assume the availability of any cryptosystems
you need for the design), and document all results obtained from each of the
following tasks:

1. To allow students to remain anonymous, each registered student is
assigned a unique and authenticable pseudonym. The assignment must
be done anonymously in the sense that no other party (a user or system)
can link a student to his/her pseudonym. Propose and explain a protocol
for such anonymous assignment of pseudonyms, state any assumptions
you have made, and justify how your proposed protocol achieves
authenticity and anonymity.

2. Propose and explain a protocol for a registered student to send a
completed questionnaire to the database using his/her pseudonym.
Justify how the proposed protocol achieves confidentiality, integrity and
authenticity.

3. Propose and explain a protocol for a registered student to request
his/her completed questionnaire from the database using his/her
pseudonym. Justify how the proposed protocol achieves confidentiality
and authenticity."

Exo merikes idees, apla thelo na paro ki alles (paradido ayrio). Oti goustarete grapste. Kala oxi oti goustarete. Oti goustarete epi tou thematos :P

Angrafan
09-12-2004, 21:48
KALYTERA NA TA PARATHSEIS, NA PAS ELLADA NA HREMHSEIS KAI NA KSANAKSEKINISEIS TO COURSE TOU XRONOU PALI KAI NA MHN AFHNEIS TIS ERGASIES SOU GIA THN TELEFTEA STIGMH

BLiTzER
09-12-2004, 21:57
AHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAH
AHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAH
AHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAH
AHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAH
AHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAH
AHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAHA
HaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAHAHaAHAHahAHahhaAHaahA
HhAahAHHAahahHAhaAHhaAHAH
AHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAH
AHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAH
AHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAH
haAHAHAHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAHAHaAHAHahAHahhaAHaahA
HhAahAHHAahahHAhaAHhaAHAHAHaAHAHahAHahhaAHaahA
HhAahAHHAahahHAhaAHhaAHAHAHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHh
aAHAHAHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAH
AHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAH
AHaAHAHahAHahhaAHaahAHhAahAHHAahahHAhaAHhaAHAHAHaAHAHahA
HahhaAHaahAHhAahAHHAahahHAhaAHhaAHAHv

DEN YPARXEIS!