473,379 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Error in my code somewhere, i think ?

hi all,

ok this is what i am trying to do. log on and authenticate. i have written the code below which asks for a serial number, which then gets passed over to the server. for the moment i am just printing the number, which gives me the code

SOCKET INFO: accept left errorno 25 and new socket 4.

however before this code appeared the numbers did not match.

anyone got any tips on whats going on here?

oh and be kind to me and keep it simple please !




server

/* get user id from client */
recv_data(sock,box);
sprintf("your settopbox number is %ld\n",box);
close_socket(sock);

client

printf("Please enter your SetTopBox Number\t");
scanf("%s",box);
printf("Please enter your Customer ID\t");
scanf("%s",id);
send_data(local_socket,box,strlen(box)+1);
send_data(local_socket,id,strlen(id)+1);
Mar 23 '07 #1
5 1110
DeMan
1,806 1GB
Could you please clarify where the numbers do not match (and how you know that they don't) - and please use code tags if posting code (use the word code to start and /code to finish both inside [ ])
Mar 23 '07 #2
hi the number that i put into the client for the settopbox, does not match the settopbox number printed on the server program.

i am hoping that the code listed below asks me for my settopbox number, which i store and then send to the server, the same applies for the customer id.

i then have the sprintf in the server to display the settopbox number.

Expand|Select|Wrap|Line Numbers
  1.  
  2. server
  3.  
  4. /* get user id from client */
  5. recv_data(sock,box);
  6. sprintf("your settopbox number is %ld\n",box);
  7. close_socket(sock);
  8.  
  9. client
  10.  
  11. printf("Please enter your SetTopBox Number\t");
  12. scanf("%s",box);
  13. printf("Please enter your Customer ID\t");
  14. scanf("%s",id);
  15. send_data(local_socket,box,strlen(box)+1);
  16. send_data(local_socket,id,strlen(id)+1);
  17.  
  18.  
Mar 23 '07 #3
DeMan
1,806 1GB
I think the problem may be that you get the Set top box number as a string (array of characters) rather than a number (try scanf("%d\n" box)).
The characters "1234" are represtented different to the number 1234 internally.
I'm also not sure why you add one to the lengths you are sending....
Mar 23 '07 #4
ok well i tried that and it got rid of my error code ....

however if i type in the settopbox number as 123456789 it equals 536850328 and if i type in the customer id as 1234 it comes out as 536850344.

can you tell me why these numbers are misrepresented ?
Mar 23 '07 #5
DeMan
1,806 1GB
I suspect you may need to take a reference from recv_data (that is &box), and possibly pass it that way to send also (I think the numbers you are geeting are memory references)
Mar 23 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: STEPHEN GOODE | last post by:
I am getting the following error. I've changed the paths and file names here to protect my client's confidentiality. Warning: session_start(): Cannot send session cache limiter - headers already...
0
by: Mike | last post by:
I'm using ASP and CDO to lookup free busy time on an e2k server. The E2K is locally installed on the IIS server and I'm having no problems accessing resources like public folders, mailboxes, etc....
30
by: Neil Zanella | last post by:
Hello, Allow me to share my frustrations with GNU g++. This is the second time something similar happens to me: I can't find anything wrong with my C++ program and yet I get segfaults, and...
65
by: Pmb | last post by:
I'm confused as to what the compiler error message I'm getting is refering to. Can someone take a gander and let me know what I did wrong? The program is below. When I compile it I get the...
3
by: Marty McDonald | last post by:
If I try to validate this xml... <?xml version="1.0" encoding="utf-8" ?> <a:FuncalcParameters xmlns:a="http://www.somewhere.fun.com/Funcalc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
10
by: DataBard007 | last post by:
Hello Access Gurus: I use Win98SE and Access97. I just built a simple Access97 application which holds all contact information for my personal contacts, such as first name, last name, address,...
6
by: José Joye | last post by:
Hello, I'm currently reading the MS Developing Web applications with c# (and VB.net). In the chapter related to Error management, there is a sample about "Page-Level Error Pages" eg: In my...
13
by: Max | last post by:
Hi There! I'm having a mysterious error right after I login using Forms Authentication in my ASP.NET app. Below is the error... Exception Details: System.NullReferenceException: Object...
11
by: Martin Joergensen | last post by:
Hi, I've encountered a really, *really*, REALLY strange error :-) I have a for-loop and after 8 runs I get strange results...... I mean: A really strange result.... I'm calculating...
18
by: robert | last post by:
Is there a ready made function in numpy/scipy to compute the correlation y=mx+o of an X and Y fast: m, m-err, o, o-err, r-coef,r-coef-err ? Or a formula to to compute the 3 error ranges? ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.