Reputation: 1
i have searched a lot but i couldn't receive bytes from Socket using java also i have a jprogressbar i couldn't update it while receiving bytes to set the value so i've tried this code:
private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_ENTER){
String az = jTextField1.getText();
if(az.contains("1")){
String hh = WorkSpace.jTextField1.getText();
Socket so = new Socket();
InputStream is = null;
ProgressMonitorInputStream pmis = null;
int buffer;
try {
so.getInputStream();
buffer = so.getReceiveBufferSize();
WorkSpace.jProgressBar1.setValue(buffer);
WorkSpace.jEditorPane1.setPage("http://www.google.com/search?q=" + hh );
}
catch (Exception e) {
}
}
please can any body say what's wrong in my code and thanks in advance
Upvotes: 0
Views: 102
Reputation: 6145
There are too many wrong things with your code. I suggest you read the Java tutorial about sockets.
Upvotes: 1