10-24-2015, 11:09 AM
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
10-24-2015, 12:32 PM
(10-24-2015, 11:09 AM)jimbo1qaz Wrote: [ -> ]isn't charging money to try a puzzle going to discourage the majority of people from trying?
No I think a person can set a amount of money someone can get if they are the first person to solve the puzzle is what he was saying. I could be wrong. :x
10-25-2015, 07:31 AM
People can set a bounty, which you will get if you solve the puzzle. They could set a fee that increases the bounty. So more people playing could motivate more to try.
Unless it turns out people just make extremely had puzzles (In the worst case, the largest puzzles may be equivalent to brute forcing hundreds of bits, if you are not able to make any deductions)
Unless it turns out people just make extremely had puzzles (In the worst case, the largest puzzles may be equivalent to brute forcing hundreds of bits, if you are not able to make any deductions)
10-28-2015, 08:07 PM
Any body know data recovery app in C++ or Java? I want to build an desktop app shown in this tutorial. I know it was build with QT, but not sure it's used third-party library or build their own.
thx
thx
10-30-2015, 07:56 PM
(10-28-2015, 08:07 PM)bruakerche Wrote: [ -> ]Any body know data recovery app in C++ or Java?http://www.cgsecurity.org/wiki/TestDisk
not sure if its good though
also, i need to get out of my system that sockets in C# suck ass.
how the hell can a send succeed when the connection is closed?
why the hell does it only realise its closed AFTER trying to read/send from the connection in which it says it went fine.
makes no sense what so ever.
10-30-2015, 09:54 PM
Uh oh, I'm doing a networking project in C# 

10-30-2015, 11:08 PM
(10-30-2015, 09:54 PM)ExtremeDude2 Wrote: [ -> ]Uh oh, I'm doing a networking project in C#
then take a look at this on how i fixed it, incase you stumble upon the same issue
i had the issue when i dc'd the client in the middle of my protocol's handshake. only on the 2nd network action the server was like "wait a minute..."
Code:
static public int SendData(ref byte[] buffer, ref Socket socket)
{
return SendData(ref buffer, 0, ref socket);
}
static public int SendData(ref byte[] buffer, int size, ref Socket socket)
{
if (buffer == null || socket == null)
return -1;
int ret = 0;
if (CheckConnection(ref socket))
{
if (size == 0)
{
ret = socket.Send(buffer);
}
else
ret = socket.Send(buffer, size, 0);
}
else
ret = -2;
return ret;
}
static public bool CheckConnection(ref Socket socket)
{
if (socket == null)
return false;
try
{
//if the socket says connected we test it to check if its true or not. C# likes saying its connected while its not it seems...
//if it says not connected then its clearly not connected
if (socket.Connected)
{
//poll the connection. the poll will return true if :
// - a connection is pending
// - data is available for reading
// - connection is closed or unavailable
//
// so if it returns false, the connection is there but nothing can be read
// if its true, we need to check if we can read data. if we can't, its either pending (useless) or closed (even more useless)
// so we mark it as closed.
bool bpoll = false;
bpoll = socket.Poll(0, SelectMode.SelectRead);
if (bpoll)
{
byte[] buff = new byte[1];
int recv_value = socket.Receive(buff, SocketFlags.Peek);
if (recv_value <= 0)
{
// Client disconnected
return false;
}
}
}
else
return false;
}
catch (SocketException ex)
{
//something went wrong. im guessing connection is closed but meh. lets just assume connection is a no go
return false;
}
return true;
}10-31-2015, 12:48 AM
Why do you pass everything using ref? This isn't VB style ByRef, class instances and arrays are passed by reference anyways. You only need the ref keyword when you intend to change where the reference points to.
Also, instead of a Socket, maybe try to use one of the more specialized classes if its a well-known protocol (such as HttpClient etc.) or one of WCFs Transport/Encoder with some actual data classes.
Also, instead of a Socket, maybe try to use one of the more specialized classes if its a well-known protocol (such as HttpClient etc.) or one of WCFs Transport/Encoder with some actual data classes.
10-31-2015, 12:50 AM
(10-31-2015, 12:48 AM)JackĀ Frost Wrote: [ -> ]Why do you pass everything using ref? This isn't VB style ByRef, class instances and arrays are passed by reference anyways. You only need the ref keyword when you intend to change where the reference points to.
Also, instead of a Socket, maybe try to use one of the more specialized classes if its a well-known protocol (such as HttpClient etc.) or one of WCFs Transport/Encoder with some actual data classes.
well, afaik just passing variables makes a copy in memory but apparently im wrong?
also, i am changing the reference in some instances (when receiving data i resize or allocate an array) btw, maybe not for the socket though
and im using sockets cause i was used to them from C/C++
im making my own server/client app with its own protocol so HTTP classes and such aren't going to do me much good. Sockets just sounded like a good, low level idea.
10-31-2015, 12:56 AM
You might want to take a look at WCF then. Simply create a bunch of classes that hold your data, define an interface that describes the contract between client and server, then tell it how to communicate (ie. using a .NET-to-.NET optimized binary protocol, for example).
Nothing wrong with sockets tho, except they're...peculiar in some cases.
Nothing wrong with sockets tho, except they're...peculiar in some cases.