Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Socket problem: read & write to same socket Date: Tue, 13 Mar 2012 15:38:16 -0700 (PDT) Organization: http://groups.google.com Lines: 33 Message-ID: <27729487.119.1331678296341.JavaMail.geo-discussion-forums@pbfz10> References: <13556496.472.1331654504832.JavaMail.geo-discussion-forums@ynhs12> <4f5fc0a2$0$282$14726298@news.sunsite.dk> <4f5fc93f$0$295$14726298@news.sunsite.dk> NNTP-Posting-Host: 69.28.149.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1331678296 5417 127.0.0.1 (13 Mar 2012 22:38:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 13 Mar 2012 22:38:16 +0000 (UTC) In-Reply-To: <4f5fc93f$0$295$14726298@news.sunsite.dk> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Received-Bytes: 2327 Xref: csiph.com comp.lang.java.programmer:12991 Arne Vajh=F8j wrote: > Martin Gregorie wrote: >> Arne Vajh=F8j wrote: >>> I believe the code shown was for a client. >>> >> I don't think so for two reasons: >> >> Firstly, to quote the last line before the Java source "I later wrote a >> server in Java and a client in Go. They work fine in both read and write= ." >> >> Secondly, because it reads before it writes - something I've never seen = a >> client do, though ymmv. >=20 > "I want to establish connection to a server(written by myself in Go > language)" >=20 > "Note that the server side only sends one line into socket." >=20 > "I later wrote a server in Java and a client in Go. They work fine in > both read and write." >=20 > I can not read that as anything else than Java client go server. Then the OP may want to have the first thing the client does be a send rath= er than a receive, per Martin's comment. Since we haven't seen the server code it's pretty hard to diagnose the prob= lem. If the OP gives us the other half of the story then we can help more. --=20 Lew