>CS assignment
>write network code in Java
I hate the fuck that Java has 50+ different ways for input/output
>CS assignment
>write network code in Java
I hate the fuck that Java has 50+ different ways for input/output
Other urls found in this thread:
docs.oracle.com
twitter.com
stupid frogposter
Just use Netty faggot
Do it in C then.
See you in 3 weeks after you've opened your first socket.
Pajeet please
Iktf OP. C sockets are unironically literally easier.
hello yes if you need help with youre assignment you can post the assignments here
i am high level master programmer of the java in my company, i can help you program the assignments
hello mr. pajeet very nice to meet you
hello yes yes i can hear you
So much this.
C sockets suck so much, they bend light.
// Java
socket = new Socket("localhost", 3141); OutputStream myOutputStream = socket.getOutputStream();
// C
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *)server->h_addr,
(char *)&serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(portno);
What the freaking hell?
Jesus, that C code is murder on my eyes. Didnt who ever wrote that stop to think about readability?
Readability is a crutch. Code should be as complicated as possible to filter out lesser humans with sub-130 IQs.
most of them are there for backwards compatibility, just use the nio stuff
Well thats the price you pay for more control and power
Its not even that hard
int sock;
sock = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in sock_info;
sock_info.sin_port = htons(80);
sock_info.sin_addr = inet_addr("1.2.3.4");
connect(sock, (struct sockaddr*)&sock_info, sizeof(sock_info));
Then you can write and read as you wish to
Newbies code like that.
Doesn't look any worse than code in native Win32 semfam
I enjoyed my network programming in C classes way more than any Java assignments.
It's CURRENT_YEAR so use Java 8 and the java.nio package
>work as java developer
>see this shit
>kid asking stupid questions
>just go to stackoverflow
>use the first shit that works
>alt + f4
>don't look back until somebody pesters you about it
when will you kids learn, when god hands you lemons, you make lemonade
>>just go to stackoverflow
>see 10 year old java.io abomination
>try hardest to use it
>no results
>get fired
thank you mr. java developer
please do the needful with the task at hand
>Doesn't look any worse than code in native Win32 semfam
Thats like saying AIDS is worse than flu farn
>just use the nio stuff
the fuck is nio?
>I hate the fuck that Java has 50+ different ways for input/output
Let's trade. I miss having flexible IO, and I'm stuck in C++.
stands for Non-blocking I/O
docs.oracle.com
hey, fuck you
rude
Doesn't java have something that is as easy to use as zeromq?
what does a message queue framework have to do with anything?
and don't act like it's part of the core language
New I/O is a better name because of stuff like java.nio.file which has little to do with non-blocking
stupid poster,who post "stupid frogposter".
Non-blocking part of it is basically all the hype though...
side question: Has anybody implemented SSH using NIO yet?
there seem to be legitimately no good SSH libraries for Java
Paths and the Files class are pretty neat though
Is the teacher Pajeet ?
Nope, I study in a white country and not Amerifat-land
Client - Server communication
>python 5 lines of code
>java 30 lines of code + 4 catches
Stream in stream in stream, output another fucking stream
Few classes just to communicate, another class for objects.
Is java really that superior?
>java 30 lines of code + 4 catches
>Stream in stream in stream, output another fucking stream
you're vastly exaggerating or using some library code from 20 years ago
>Is java really that superior?
it's tens to hundreds times faster
What a retarded strawman, Python only offers syntactic sugar, the rest is purely based on the library you use.
When you call python syntax syntetic sugar then whats is the name of java syntax?
The java code doesnt make any sense, wtf is an output stream?
>CS
>programming
It's your own fault for choosing crap school.
Welp, If we use male - female analogy, then outputstream is male
What?
Basically anything that ends with Stream is an object that has two methods: boolean .hasNext() and byte .next().
.next() returns the next byte and you have to handle it. So an output stream of a socket is how you get the data from it.
>The java code doesnt make any sense
>but that C clusterfuck does
why do you keep saying java is for rajesh's
it's a fine language, low enough level, versatile (android/fast scalable web back end/web applets/desktop apps), fast enough... and the JVM can run Scala/Clojure
I don't see what's bad with java
You see, on Sup Forums people often say things they don't really mean.
It's called "trolling" or "pretending to be retarded"..
In fact you're well off doing exactly the opposite of what Sup Forums tells you to do.
here, no noise
no noise